use of org.ethereum.core.Account in project rskj by rsksmart.
the class TransactionPoolImplTest method rejectTransactionPoolTransaction.
@Test
public void rejectTransactionPoolTransaction() {
BlockChainImpl blockchain = createBlockchain();
Coin balance = Coin.valueOf(1000000);
TransactionPoolImpl transactionPool = createSampleNewTransactionPoolWithAccounts(2, balance, blockchain);
transactionPool.processBest(blockchain.getBestBlock());
Transaction tx = createSampleTransaction(1, 2, 1000, 0);
tx.setGasLimit(BigInteger.valueOf(3000001).toByteArray());
Account receiver = createAccount(2);
transactionPool.addTransaction(tx);
Repository repository = transactionPool.getRepository();
Assert.assertEquals(BigInteger.valueOf(1000000), repository.getBalance(receiver.getAddress()).asBigInteger());
}
use of org.ethereum.core.Account in project rskj by rsksmart.
the class TransactionPoolImplTest method usingAccountsWithInitialBalance.
@Test
public void usingAccountsWithInitialBalance() {
TransactionPoolImpl transactionPool = createSampleNewTransactionPoolWithAccounts(2, Coin.valueOf(10L), createBlockchain());
Repository repository = transactionPool.getRepository();
Assert.assertNotNull(repository);
Account account1 = createAccount(1);
Account account2 = createAccount(2);
Assert.assertEquals(BigInteger.TEN, repository.getBalance(account1.getAddress()).asBigInteger());
Assert.assertEquals(BigInteger.TEN, repository.getBalance(account2.getAddress()).asBigInteger());
}
use of org.ethereum.core.Account in project rskj by rsksmart.
the class TransactionPoolImplTest method updateTransactionPool.
@Test
public void updateTransactionPool() {
BlockChainImpl blockchain = createBlockchain();
Coin balance = Coin.valueOf(1000000);
TransactionPoolImpl transactionPool = createSampleNewTransactionPoolWithAccounts(2, balance, blockchain);
transactionPool.processBest(blockchain.getBestBlock());
Transaction tx1 = createSampleTransaction(1, 2, 1000, 0);
Transaction tx2 = createSampleTransaction(1, 2, 3000, 1);
Account receiver = createAccount(2);
transactionPool.addTransaction(tx1);
transactionPool.addTransaction(tx2);
transactionPool.updateState();
Repository repository = transactionPool.getRepository();
Assert.assertEquals(BigInteger.valueOf(1004000), repository.getBalance(receiver.getAddress()).asBigInteger());
}
use of org.ethereum.core.Account in project rskj by rsksmart.
the class TransactionPoolImplTest method addAndExecutePendingTransaction.
@Test
public void addAndExecutePendingTransaction() {
BlockChainImpl blockchain = createBlockchain();
Coin balance = Coin.valueOf(1000000);
TransactionPoolImpl transactionPool = createSampleNewTransactionPoolWithAccounts(2, balance, blockchain);
transactionPool.processBest(blockchain.getBestBlock());
Transaction tx = createSampleTransaction(1, 2, 1000, 0);
Account receiver = createAccount(2);
transactionPool.addTransaction(tx);
Repository repository = transactionPool.getRepository();
Assert.assertEquals(BigInteger.valueOf(1001000), repository.getBalance(receiver.getAddress()).asBigInteger());
}
use of org.ethereum.core.Account in project rskj by rsksmart.
the class TxPoolModuleImplTest method getAccount.
private Account getAccount(int naccount) {
Account account = accountMap.get(naccount);
if (account != null) {
return account;
}
account = createAccount(naccount);
accountMap.put(naccount, account);
return account;
}
Aggregations