Search in sources :

Example 61 with Account

use of org.ethereum.core.Account in project rskj by rsksmart.

the class TransactionPoolImplTest method createSampleNewTransactionPoolWithAccounts.

private static TransactionPoolImpl createSampleNewTransactionPoolWithAccounts(int naccounts, Coin balance, BlockChainImpl blockChain) {
    Block best = blockChain.getStatus().getBestBlock();
    Repository repository = blockChain.getRepository();
    Repository track = repository.startTracking();
    for (int k = 1; k <= naccounts; k++) {
        Account account = createAccount(k);
        track.createAccount(account.getAddress());
        track.addBalance(account.getAddress(), balance);
    }
    track.commit();
    best.setStateRoot(repository.getRoot());
    best.flushRLP();
    TransactionPoolImpl transactionPool = new TransactionPoolImpl(config, blockChain.getRepository(), blockChain.getBlockStore(), null, new ProgramInvokeFactoryImpl(), new BlockExecutorTest.SimpleEthereumListener(), 10, 100);
    blockChain.setTransactionPool(transactionPool);
    return transactionPool;
}
Also used : Account(org.ethereum.core.Account) Repository(org.ethereum.core.Repository) Block(org.ethereum.core.Block) ProgramInvokeFactoryImpl(org.ethereum.vm.program.invoke.ProgramInvokeFactoryImpl)

Example 62 with Account

use of org.ethereum.core.Account in project rskj by rsksmart.

the class Wallet method addAccountWithPrivateKey.

public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) {
    Account account = new Account(ECKey.fromPrivate(privateKeyBytes));
    synchronized (accessLock) {
        RskAddress addr = addAccount(account);
        this.initialAccounts.add(addr);
        return addr.getBytes();
    }
}
Also used : Account(org.ethereum.core.Account)

Aggregations

Account (org.ethereum.core.Account)62 Test (org.junit.Test)34 Transaction (org.ethereum.core.Transaction)26 AccountBuilder (co.rsk.test.builders.AccountBuilder)22 TransactionBuilder (co.rsk.test.builders.TransactionBuilder)16 World (co.rsk.test.World)15 DslParser (co.rsk.test.dsl.DslParser)11 WorldDslProcessor (co.rsk.test.dsl.WorldDslProcessor)11 BigInteger (java.math.BigInteger)10 RskAddress (co.rsk.core.RskAddress)5 RepositorySnapshot (co.rsk.db.RepositorySnapshot)5 Block (org.ethereum.core.Block)5 Repository (org.ethereum.core.Repository)5 ReceiptStore (org.ethereum.db.ReceiptStore)5 ECKey (org.ethereum.crypto.ECKey)4 Coin (co.rsk.core.Coin)3 Keccak256 (co.rsk.crypto.Keccak256)3 Trie (co.rsk.trie.Trie)3 ArrayList (java.util.ArrayList)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2