Search in sources :

Example 6 with MutableTrieImpl

use of co.rsk.db.MutableTrieImpl in project rskj by rsksmart.

the class BridgeStateTest method recreateFromEmptyStorageProvider.

@Test
public void recreateFromEmptyStorageProvider() throws IOException {
    TestSystemProperties config = new TestSystemProperties();
    TrieStore trieStore = new TrieStoreImpl(new HashMapDB());
    Repository repository = new MutableRepository(new MutableTrieImpl(trieStore, new Trie(trieStore)));
    BridgeConstants bridgeConstants = config.getNetworkConstants().getBridgeConstants();
    BridgeStorageProvider provider = new BridgeStorageProvider(repository, PrecompiledContracts.BRIDGE_ADDR, bridgeConstants, config.getActivationConfig().forBlock(0L));
    BridgeState state = new BridgeState(42, provider, null);
    BridgeState clone = BridgeState.create(bridgeConstants, state.getEncoded(), null);
    Assert.assertNotNull(clone);
    Assert.assertEquals(42, clone.getBtcBlockchainBestChainHeight());
    Assert.assertTrue(clone.getActiveFederationBtcUTXOs().isEmpty());
    Assert.assertTrue(clone.getRskTxsWaitingForSignatures().isEmpty());
}
Also used : TrieStoreImpl(co.rsk.trie.TrieStoreImpl) Repository(org.ethereum.core.Repository) MutableRepository(org.ethereum.db.MutableRepository) MutableRepository(org.ethereum.db.MutableRepository) MutableTrieImpl(co.rsk.db.MutableTrieImpl) HashMapDB(org.ethereum.datasource.HashMapDB) TrieStore(co.rsk.trie.TrieStore) Trie(co.rsk.trie.Trie) BridgeConstants(co.rsk.config.BridgeConstants) TestSystemProperties(co.rsk.config.TestSystemProperties) Test(org.junit.Test)

Aggregations

MutableTrieImpl (co.rsk.db.MutableTrieImpl)6 Trie (co.rsk.trie.Trie)6 MutableRepository (org.ethereum.db.MutableRepository)6 TrieStore (co.rsk.trie.TrieStore)5 TrieStoreImpl (co.rsk.trie.TrieStoreImpl)5 HashMapDB (org.ethereum.datasource.HashMapDB)5 Repository (org.ethereum.core.Repository)3 Test (org.junit.Test)3 TestGenesisLoader (co.rsk.core.genesis.TestGenesisLoader)2 HashMapBlocksIndex (co.rsk.db.HashMapBlocksIndex)2 BigInteger (java.math.BigInteger)2 Block (org.ethereum.core.Block)2 ECKey (org.ethereum.crypto.ECKey)2 IndexedBlockStore (org.ethereum.db.IndexedBlockStore)2 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)1 BridgeConstants (co.rsk.config.BridgeConstants)1 TestSystemProperties (co.rsk.config.TestSystemProperties)1 Coin (co.rsk.core.Coin)1 RskAddress (co.rsk.core.RskAddress)1 MutableTrieCache (co.rsk.db.MutableTrieCache)1