This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added in a fixed difficulty acceptance test.
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...va/tech/pegasys/pantheon/tests/acceptance/mining/FixedMiningDifficultyAcceptanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package tech.pegasys.pantheon.tests.acceptance.mining; | ||
|
||
import static org.web3j.utils.Convert.Unit.ETHER; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.account.Account; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; | ||
|
||
public class FixedMiningDifficultyAcceptanceTest extends AcceptanceTestBase { | ||
private Node minerNode; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
minerNode = pantheon.createFixedDifficultyMinerNode("node1"); | ||
cluster.start(minerNode); | ||
} | ||
|
||
@Test | ||
public void shouldMineTransactions() { | ||
final Account sender = accounts.createAccount("account1"); | ||
final Account receiver = accounts.createAccount("account2"); | ||
minerNode.execute(transactions.createTransfer(sender, 50)); | ||
cluster.verify(sender.balanceEquals(50)); | ||
|
||
minerNode.execute(transactions.createIncrementalTransfers(sender, receiver, 1)); | ||
cluster.verify(receiver.balanceEquals(1)); | ||
|
||
minerNode.execute(transactions.createIncrementalTransfers(sender, receiver, 2)); | ||
cluster.verify(receiver.balanceEquals(3)); | ||
|
||
minerNode.execute(transactions.createIncrementalTransfers(sender, receiver, 3)); | ||
cluster.verify(receiver.balanceEquals(6)); | ||
|
||
minerNode.execute(transactions.createIncrementalTransfers(sender, receiver, 4)); | ||
cluster.verify(receiver.balanceEquals(10)); | ||
|
||
minerNode.execute(transactions.createIncrementalTransfers(sender, receiver, 5)); | ||
cluster.verify(receiver.balanceEquals(15)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"config": { | ||
"chainId": 4, | ||
"homesteadBlock": 1, | ||
"eip150Block": 2, | ||
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"eip155Block": 3, | ||
"eip158Block": 3, | ||
"byzantiumBlock": 1035301, | ||
"ethash": { | ||
"fixeddifficulty": 100 | ||
} | ||
}, | ||
"nonce": "0x0", | ||
"timestamp": "0x58ee40ba", | ||
"gasLimit": "0x47b760", | ||
"difficulty": "0x1", | ||
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365", | ||
"coinbase": "0x0000000000000000000000000000000000000000", | ||
"alloc": { | ||
"fe3b557e8fb62b89f4916b721be55ceb828dbd73": { | ||
"privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", | ||
"comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", | ||
"balance": "0xad78ebc5ac6200000" | ||
}, | ||
"627306090abaB3A6e1400e9345bC60c78a8BEf57": { | ||
"privateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", | ||
"comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", | ||
"balance": "90000000000000000000000" | ||
}, | ||
"f17f52151EbEF6C7334FAD080c5704D77216b732": { | ||
"privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f", | ||
"comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", | ||
"balance": "90000000000000000000000" | ||
} | ||
}, | ||
"number": "0x0", | ||
"gasUsed": "0x0", | ||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" | ||
} |