Search in sources :

Example 6 with Ethereum

use of org.ethereum.facade.Ethereum in project rskj by rsksmart.

the class Web3ImplTest method eth_mining.

@Test
public void eth_mining() {
    Ethereum ethMock = Web3Mocks.getMockEthereum();
    Blockchain blockchain = Web3Mocks.getMockBlockchain();
    TransactionPool transactionPool = Web3Mocks.getMockTransactionPool();
    BlockStore blockStore = Web3Mocks.getMockBlockStore();
    RskSystemProperties mockProperties = Web3Mocks.getMockProperties();
    MinerClient minerClient = new SimpleMinerClient();
    PersonalModule personalModule = new PersonalModuleWalletDisabled();
    TxPoolModule txPoolModule = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
    Web3 web3 = new Web3Impl(ethMock, blockchain, transactionPool, blockStore, null, mockProperties, minerClient, null, personalModule, null, txPoolModule, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, null, null, null, null);
    Assert.assertTrue("Node is not mining", !web3.eth_mining());
    try {
        minerClient.mine();
        Assert.assertTrue("Node is mining", web3.eth_mining());
    } finally {
        minerClient.stop();
    }
    Assert.assertTrue("Node is not mining", !web3.eth_mining());
}
Also used : BlockStore(org.ethereum.db.BlockStore) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) PersonalModuleWalletDisabled(co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled) MinerClient(co.rsk.mine.MinerClient) Ethereum(org.ethereum.facade.Ethereum) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) RskSystemProperties(co.rsk.config.RskSystemProperties) Test(org.junit.Test)

Aggregations

Ethereum (org.ethereum.facade.Ethereum)6 RskSystemProperties (co.rsk.config.RskSystemProperties)5 PersonalModuleWalletDisabled (co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled)5 Test (org.junit.Test)5 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)4 TxPoolModule (co.rsk.rpc.modules.txpool.TxPoolModule)3 TxPoolModuleImpl (co.rsk.rpc.modules.txpool.TxPoolModuleImpl)3 ExecutionBlockRetriever (co.rsk.rpc.ExecutionBlockRetriever)2 Web3RskImpl (co.rsk.rpc.Web3RskImpl)2 EthModule (co.rsk.rpc.modules.eth.EthModule)2 SystemProperties (org.ethereum.config.SystemProperties)2 BlockStore (org.ethereum.db.BlockStore)2 CompilationResultDTO (org.ethereum.rpc.dto.CompilationResultDTO)2 MinerClient (co.rsk.mine.MinerClient)1 MinerServer (co.rsk.mine.MinerServer)1 EthModuleSolidityDisabled (co.rsk.rpc.modules.eth.EthModuleSolidityDisabled)1 EthModuleSolidityEnabled (co.rsk.rpc.modules.eth.EthModuleSolidityEnabled)1 EthModuleWalletEnabled (co.rsk.rpc.modules.eth.EthModuleWalletEnabled)1 ConfigFactory (com.typesafe.config.ConfigFactory)1 File (java.io.File)1