Search in sources :

Example 1 with PendingState

use of co.rsk.core.bc.PendingState in project rskj by rsksmart.

the class EthModuleTest method getCode.

@Test
public void getCode() {
    byte[] expectedCode = new byte[] { 1, 2, 3 };
    TransactionPool mockTransactionPool = mock(TransactionPool.class);
    PendingState mockPendingState = mock(PendingState.class);
    doReturn(expectedCode).when(mockPendingState).getCode(any(RskAddress.class));
    doReturn(mockPendingState).when(mockTransactionPool).getPendingState();
    EthModule eth = new EthModule(null, (byte) 0, null, mockTransactionPool, null, null, null, null, null, new BridgeSupportFactory(null, null, null), config.getGasEstimationCap());
    String addr = eth.getCode(TestUtils.randomAddress().toHexString(), "pending");
    Assert.assertThat(Hex.decode(addr.substring("0x".length())), is(expectedCode));
}
Also used : TransactionPool(org.ethereum.core.TransactionPool) PendingState(co.rsk.core.bc.PendingState) RskAddress(co.rsk.core.RskAddress) BridgeSupportFactory(co.rsk.peg.BridgeSupportFactory) Test(org.junit.Test)

Example 2 with PendingState

use of co.rsk.core.bc.PendingState in project rskj by rsksmart.

the class Web3InformationRetrieverTest method getState_pending.

@Test
public void getState_pending() {
    PendingState aip = mock(PendingState.class);
    when(txPool.getPendingState()).thenReturn(aip);
    AccountInformationProvider result = target.getInformationProvider("pending");
    assertEquals(aip, result);
}
Also used : PendingState(co.rsk.core.bc.PendingState) AccountInformationProvider(co.rsk.core.bc.AccountInformationProvider) Test(org.junit.Test)

Aggregations

PendingState (co.rsk.core.bc.PendingState)2 Test (org.junit.Test)2 RskAddress (co.rsk.core.RskAddress)1 AccountInformationProvider (co.rsk.core.bc.AccountInformationProvider)1 BridgeSupportFactory (co.rsk.peg.BridgeSupportFactory)1 TransactionPool (org.ethereum.core.TransactionPool)1