本文整理汇总了Java中org.ethereum.util.blockchain.StandaloneBlockchain.sendEther方法的典型用法代码示例。如果您正苦于以下问题:Java StandaloneBlockchain.sendEther方法的具体用法?Java StandaloneBlockchain.sendEther怎么用?Java StandaloneBlockchain.sendEther使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ethereum.util.blockchain.StandaloneBlockchain
的用法示例。
在下文中一共展示了StandaloneBlockchain.sendEther方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: backwardCompatibleDbTest
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void backwardCompatibleDbTest() {
// check that we can read previously saved entries (saved with legacy code)
HashMapDB txDb = new HashMapDB();
TransactionStore transactionStore = new TransactionStore(txDb);
StandaloneBlockchain bc = new StandaloneBlockchain();
bc.getBlockchain().withTransactionStore(transactionStore);
bc.sendEther(new byte[20], BigInteger.valueOf(1000));
Block b1 = bc.createBlock();
Transaction tx = b1.getTransactionsList().get(0);
TransactionInfo info = transactionStore.get(tx.getHash()).get(0);
HashMapDB<byte[]> txDb1 = new HashMapDB<>();
txDb1.put(tx.getHash(), info.getEncoded()); // legacy serialization
TransactionStore transactionStore1 = new TransactionStore(txDb1);
TransactionInfo info1 = transactionStore1.get(tx.getHash()).get(0);
Assert.assertArrayEquals(info1.getReceipt().getPostTxState(), info.getReceipt().getPostTxState());
}
示例2: testBlockOnlyIncluded
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testBlockOnlyIncluded() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
bc.submitTransaction(tx1);
Block b2 = bc.createBlock();
Block b2_ = bc.createForkBlock(b1);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
Block b3_ = bc.createForkBlock(b2_);
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), PENDING);
}
示例3: invalidTxTest
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void invalidTxTest() {
// check that invalid tx doesn't break implementation
StandaloneBlockchain sb = new StandaloneBlockchain();
ECKey alice = sb.getSender();
ECKey bob = new ECKey();
sb.sendEther(bob.getAddress(), BigInteger.valueOf(1000));
sb.setSender(bob);
sb.sendEther(alice.getAddress(), BigInteger.ONE);
sb.setSender(alice);
sb.sendEther(bob.getAddress(), BigInteger.valueOf(2000));
sb.createBlock();
}
示例4: simpleRebranch
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void simpleRebranch() {
StandaloneBlockchain sb = new StandaloneBlockchain();
Block b0 = sb.getBlockchain().getBestBlock();
ECKey addr1 = ECKey.fromPrivate(HashUtil.sha3("1".getBytes()));
BigInteger bal2 = sb.getBlockchain().getRepository().getBalance(sb.getSender().getAddress());
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(100));
Block b1 = sb.createBlock();
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(100));
Block b2 = sb.createBlock();
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(100));
Block b3 = sb.createBlock();
BigInteger bal1 = sb.getBlockchain().getRepository().getBalance(addr1.getAddress());
Assert.assertEquals(BigInteger.valueOf(300), bal1);
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(200));
Block b1_ = sb.createForkBlock(b0);
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(200));
Block b2_ = sb.createForkBlock(b1_);
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(200));
Block b3_ = sb.createForkBlock(b2_);
sb.sendEther(addr1.getAddress(), BigInteger.valueOf(200));
Block b4_ = sb.createForkBlock(b3_);
BigInteger bal1_ = sb.getBlockchain().getRepository().getBalance(addr1.getAddress());
Assert.assertEquals(BigInteger.valueOf(800), bal1_);
// BigInteger bal2_ = sb.getBlockchain().getRepository().getBalance(sb.getSender().getAddress());
// Assert.assertEquals(bal2, bal2_);
}
示例5: spendGasSimpleTest
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void spendGasSimpleTest() throws IOException, InterruptedException {
// check the caller spend value for tx
StandaloneBlockchain bc = new StandaloneBlockchain().withGasPrice(1);
BigInteger balance1 = bc.getBlockchain().getRepository().getBalance(bc.getSender().getAddress());
bc.sendEther(new byte[20], BigInteger.ZERO);
bc.createBlock();
BigInteger balance2 = bc.getBlockchain().getRepository().getBalance(bc.getSender().getAddress());
long spent = balance1.subtract(balance2).longValue();
Assert.assertNotEquals(0, spent);
}
示例6: testOldBlockIncluded
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testOldBlockIncluded() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
ECKey charlie = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
for (int i = 0; i < 16; i++) {
bc.createBlock();
}
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
pendingState.addPendingTransaction(tx1);
Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
bc.submitTransaction(tx1);
Block b2_ = bc.createForkBlock(b1);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
bc.submitTransaction(tx1);
Block b18 = bc.createBlock();
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b18.getHash());
}
示例7: testTrackTx1
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testTrackTx1() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Block b2 = bc.createBlock();
Block b3 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
bc.submitTransaction(tx1);
Block b2_ = bc.createForkBlock(b1);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
pendingState.trackTransaction(tx1);
Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
Block b3_ = bc.createForkBlock(b2_);
Block b4_ = bc.createForkBlock(b3_);
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b2_.getHash());
}
示例8: testPrevBlock
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testPrevBlock() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
SolidityContract contract = bc.submitNewContract("contract A {" +
" function getPrevBlockHash() returns (bytes32) {" +
" return block.blockhash(block.number - 1);" +
" }" +
"}");
bc.sendEther(bob.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Block b2 = bc.createBlock();
Block b3 = bc.createBlock();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd;
contract.callFunction("getPrevBlockHash");
bc.generatePendingTransactions();
txUpd = l.onPendingTransactionUpdate.values().iterator().next().poll();
Assert.assertArrayEquals(txUpd.getLeft().getExecutionResult(), b3.getHash());
}
示例9: testTrackTx2
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testTrackTx2() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
bc.submitTransaction(tx1);
Block b2 = bc.createBlock();
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
pendingState.trackTransaction(tx1);
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b2.getHash());
Block b2_ = bc.createForkBlock(b1);
Block b3_ = bc.createForkBlock(b2_);
Assert.assertEquals(l.pollTxUpdateState(tx1), PENDING);
}
示例10: rewriteSameTrieNode
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Ignore
@Test
public void rewriteSameTrieNode() throws Exception {
final int pruneCount = 3;
SystemProperties.getDefault().overrideParams(
"database.prune.enabled", "true",
"database.prune.maxDepth", "" + pruneCount);
StandaloneBlockchain bc = new StandaloneBlockchain();
byte[] receiver = Hex.decode("0000000000000000000000000000000000000000");
bc.sendEther(receiver, BigInteger.valueOf(0x77777777));
bc.createBlock();
for (int i = 0; i < 100; i++) {
bc.sendEther(new ECKey().getAddress(), BigInteger.valueOf(i));
}
SolidityContract contr = bc.submitNewContract(
"contract Stupid {" +
" function wrongAddress() { " +
" address addr = 0x0000000000000000000000000000000000000000; " +
" addr.call();" +
" } " +
"}");
Block b1 = bc.createBlock();
contr.callFunction("wrongAddress");
Block b2 = bc.createBlock();
contr.callFunction("wrongAddress");
Block b3 = bc.createBlock();
Assert.assertEquals(BigInteger.valueOf(0xaaaaaaaaaaaaL), contr.callConstFunction("n")[0]);
}
示例11: testSimple
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testSimple() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
bc.sendEther(new byte[20], BigInteger.valueOf(100000));
bc.sendEther(new byte[20], BigInteger.valueOf(100000));
bc.createBlock();
l.onBlock.poll(5, SECONDS);
Transaction tx1 = bc.createTransaction(100, new byte[32], 1000, new byte[0]);
pendingState.addPendingTransaction(tx1);
// dropped due to large nonce
Assert.assertEquals(l.pollTxUpdateState(tx1), DROPPED);
Transaction tx1_ = bc.createTransaction(0, new byte[32], 1000, new byte[0]);
pendingState.addPendingTransaction(tx1_);
// dropped due to low nonce
Assert.assertEquals(l.pollTxUpdateState(tx1_), DROPPED);
Transaction tx2 = bc.createTransaction(2, alice.getAddress(), 1000000, new byte[0]);
Transaction tx3 = bc.createTransaction(3, alice.getAddress(), 1000000, new byte[0]);
pendingState.addPendingTransaction(tx2);
pendingState.addPendingTransaction(tx3);
txUpd = l.pollTxUpdate(tx2);
Assert.assertEquals(txUpd.getMiddle(), NEW_PENDING);
Assert.assertTrue(txUpd.getLeft().isValid());
txUpd = l.pollTxUpdate(tx3);
Assert.assertEquals(txUpd.getMiddle(), NEW_PENDING);
Assert.assertTrue(txUpd.getLeft().isValid());
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000 - 100000)) > 0);
pendingState.addPendingTransaction(tx2); // double transaction submit
Assert.assertTrue(l.getQueueFor(tx2).isEmpty());
bc.createBlock();
Assert.assertEquals(l.pollTxUpdateState(tx2), PENDING);
Assert.assertEquals(l.pollTxUpdateState(tx3), PENDING);
bc.submitTransaction(tx2);
Block b3 = bc.createBlock();
txUpd = l.pollTxUpdate(tx2);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertEquals(txUpd.getRight(), b3);
Assert.assertEquals(l.pollTxUpdateState(tx3), PENDING);
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000 - 100000)) > 0);
for (int i = 0; i < SystemProperties.getDefault().txOutdatedThreshold() + 1; i++) {
bc.createBlock();
txUpd = l.pollTxUpdate(tx3);
if (txUpd.getMiddle() != PENDING) break;
}
// tx3 dropped due to timeout
Assert.assertEquals(txUpd.getMiddle(), DROPPED);
Assert.assertEquals(txUpd.getLeft().getTransaction(), tx3);
Assert.assertFalse(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000 - 100000)) > 0);
}
示例12: testRebranch1
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testRebranch1() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
ECKey charlie = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
bc.sendEther(charlie.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
pendingState.addPendingTransaction(tx1);
Transaction tx2 = bc.createTransaction(charlie, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);;
pendingState.addPendingTransaction(tx2);
Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
Assert.assertEquals(l.pollTxUpdateState(tx2), NEW_PENDING);
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000)) == 0);
bc.submitTransaction(tx1);
Block b2 = bc.createBlock();
Assert.assertEquals(l.pollTxUpdateState(tx1), INCLUDED);
Assert.assertEquals(l.pollTxUpdateState(tx2), PENDING);
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000)) == 0);
bc.submitTransaction(tx2);
Block b3 = bc.createBlock();
Assert.assertEquals(l.pollTxUpdateState(tx2), INCLUDED);
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000)) == 0);
Block b2_ = bc.createForkBlock(b1);
Block b3_ = bc.createForkBlock(b2_);
bc.submitTransaction(tx2);
Block b4_ = bc.createForkBlock(b3_);
Assert.assertEquals(l.pollTxUpdateState(tx1), PENDING);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
Assert.assertEquals(l.pollTxUpdateState(tx2), INCLUDED);
Assert.assertTrue(l.getQueueFor(tx2).isEmpty());
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000)) == 0);
bc.submitTransaction(tx1);
Block b5_ = bc.createForkBlock(b4_);
Assert.assertEquals(l.pollTxUpdateState(tx1), INCLUDED);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
Assert.assertTrue(l.getQueueFor(tx2).isEmpty());
Assert.assertTrue(pendingState.getRepository().getBalance(alice.getAddress()).
compareTo(BigInteger.valueOf(2000000)) == 0);
}
示例13: testRebranch3
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testRebranch3() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
ECKey charlie = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
bc.sendEther(charlie.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
pendingState.addPendingTransaction(tx1);
Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
bc.submitTransaction(tx1);
Block b2 = bc.createBlock();
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
Block b3 = bc.createBlock();
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
bc.submitTransaction(tx1);
Block b2_ = bc.createForkBlock(b1);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
Block b3_ = bc.createForkBlock(b2_);
Block b4_ = bc.createForkBlock(b3_);
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b2_.getHash());
Block b4 = bc.createForkBlock(b3);
Block b5 = bc.createForkBlock(b4);
txUpd = l.pollTxUpdate(tx1);
Assert.assertEquals(txUpd.getMiddle(), INCLUDED);
Assert.assertArrayEquals(txUpd.getRight().getHash(), b2.getHash());
}
示例14: testRejected1
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testRejected1() throws InterruptedException {
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
ECKey charlie = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
bc.sendEther(charlie.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
pendingState.addPendingTransaction(tx1);
Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
bc.submitTransaction(tx1);
Block b2_ = bc.createForkBlock(b1);
Assert.assertEquals(l.pollTxUpdateState(tx1), INCLUDED);
Block b2 = bc.createForkBlock(b1);
Block b3 = bc.createForkBlock(b2);
Assert.assertEquals(l.pollTxUpdateState(tx1), PENDING);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
for (int i = 0; i < 16; i++) {
bc.createBlock();
EthereumListener.PendingTransactionState state = l.pollTxUpdateState(tx1);
if (state == EthereumListener.PendingTransactionState.DROPPED) {
break;
}
if (i == 15) {
throw new RuntimeException("Transaction was not dropped");
}
}
}
示例15: testIncludedRejected
import org.ethereum.util.blockchain.StandaloneBlockchain; //导入方法依赖的package包/类
@Test
public void testIncludedRejected() throws InterruptedException {
// check INCLUDED => DROPPED state transition when a new (long) fork without
// the transaction becomes the main chain
StandaloneBlockchain bc = new StandaloneBlockchain();
PendingListener l = new PendingListener();
bc.addEthereumListener(l);
Triple<TransactionReceipt, EthereumListener.PendingTransactionState, Block> txUpd = null;
PendingStateImpl pendingState = (PendingStateImpl) bc.getBlockchain().getPendingState();
ECKey alice = new ECKey();
ECKey bob = new ECKey();
ECKey charlie = new ECKey();
bc.sendEther(bob.getAddress(), convert(100, ETHER));
bc.sendEther(charlie.getAddress(), convert(100, ETHER));
Block b1 = bc.createBlock();
Transaction tx1 = bc.createTransaction(bob, 0, alice.getAddress(), BigInteger.valueOf(1000000), new byte[0]);
pendingState.addPendingTransaction(tx1);
Assert.assertEquals(l.pollTxUpdateState(tx1), NEW_PENDING);
bc.submitTransaction(tx1);
Block b2 = bc.createForkBlock(b1);
Assert.assertEquals(l.pollTxUpdateState(tx1), INCLUDED);
for (int i = 0; i < 10; i++) {
bc.createBlock();
}
Block b_ = bc.createForkBlock(b1);
for (int i = 0; i < 11; i++) {
b_ = bc.createForkBlock(b_);
}
Assert.assertEquals(l.pollTxUpdateState(tx1), DROPPED);
Assert.assertTrue(l.getQueueFor(tx1).isEmpty());
}