Search in sources :

Example 86 with Blockchain

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

the class Web3ImplSnapshotTest method resetSnapshots.

@Test
public void resetSnapshots() {
    World world = new World();
    Web3Impl web3 = createWeb3(world);
    Blockchain blockchain = world.getBlockChain();
    BlockChainStatus status = blockchain.getStatus();
    addBlocks(blockchain, 10);
    Assert.assertEquals(10, blockchain.getBestBlock().getNumber());
    web3.evm_reset();
    Assert.assertEquals(0, blockchain.getBestBlock().getNumber());
    BlockChainStatus newStatus = blockchain.getStatus();
    Assert.assertEquals(status.getBestBlock().getHash(), newStatus.getBestBlock().getHash());
    Assert.assertEquals(status.getTotalDifficulty(), newStatus.getTotalDifficulty());
}
Also used : Blockchain(org.ethereum.core.Blockchain) BlockChainStatus(co.rsk.core.bc.BlockChainStatus) World(co.rsk.test.World) Test(org.junit.Test)

Aggregations

Blockchain (org.ethereum.core.Blockchain)86 Test (org.junit.Test)75 Block (org.ethereum.core.Block)51 SyncConfiguration (co.rsk.net.sync.SyncConfiguration)47 RskSystemProperties (co.rsk.config.RskSystemProperties)45 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)38 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)25 World (co.rsk.test.World)19 SimpleAsyncNode (co.rsk.net.simples.SimpleAsyncNode)14 Keccak256 (co.rsk.crypto.Keccak256)7 Ignore (org.junit.Ignore)7 DummyBlockValidationRule (co.rsk.validators.DummyBlockValidationRule)5 BlockIdentifier (org.ethereum.core.BlockIdentifier)3 BlockChainStatus (co.rsk.core.bc.BlockChainStatus)2 NewBlockHashMessage (co.rsk.net.messages.NewBlockHashMessage)2 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)2 Repository (org.ethereum.core.Repository)2 SimpleChannelManager (org.ethereum.rpc.Simples.SimpleChannelManager)2 BlockStoreException (co.rsk.bitcoinj.store.BlockStoreException)1 BlockDifficulty (co.rsk.core.BlockDifficulty)1