Search in sources :

Example 56 with RepositoryImpl

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

the class RemascStorageProviderTest method getDefautRewardBalance.

@Test
public void getDefautRewardBalance() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    Assert.assertEquals(Coin.ZERO, provider.getRewardBalance());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) Test(org.junit.Test)

Example 57 with RepositoryImpl

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

the class RemascStorageProviderTest method getDefaultSiblings.

@Test
public void getDefaultSiblings() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    SortedMap<Long, List<Sibling>> map = provider.getSiblings();
    Assert.assertNotNull(map);
    Assert.assertTrue(map.isEmpty());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 58 with RepositoryImpl

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

the class RemascStorageProviderTest method setAndGetRewardBalance.

@Test
public void setAndGetRewardBalance() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    provider.setRewardBalance(Coin.valueOf(1));
    Assert.assertEquals(Coin.valueOf(1), provider.getRewardBalance());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) Test(org.junit.Test)

Example 59 with RepositoryImpl

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

the class RemascStorageProviderTest method getDefautBurnedBalance.

@Test
public void getDefautBurnedBalance() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    Assert.assertEquals(Coin.ZERO, provider.getBurnedBalance());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) Test(org.junit.Test)

Example 60 with RepositoryImpl

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

the class RemascStorageProviderTest method setAndGetSiblings.

@Test
public void setAndGetSiblings() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    BlockGenerator blockGenerator = new BlockGenerator();
    Block genesis = blockGenerator.getGenesisBlock();
    Block block = blockGenerator.createChildBlock(genesis);
    Sibling sibling1 = new Sibling(genesis.getHeader(), genesis.getCoinbase(), 1);
    Sibling sibling2 = new Sibling(block.getHeader(), block.getCoinbase(), 2);
    List<Sibling> siblings = new ArrayList<>();
    siblings.add(sibling1);
    siblings.add(sibling2);
    provider.getSiblings().put(Long.valueOf(1), siblings);
    SortedMap<Long, List<Sibling>> map = provider.getSiblings();
    Assert.assertNotNull(map);
    Assert.assertFalse(map.isEmpty());
    Assert.assertTrue(map.containsKey(Long.valueOf(1)));
    Assert.assertEquals(2, map.get(Long.valueOf(1)).size());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) ArrayList(java.util.ArrayList) Block(org.ethereum.core.Block) ArrayList(java.util.ArrayList) List(java.util.List) BlockGenerator(co.rsk.blockchain.utils.BlockGenerator) Test(org.junit.Test)

Aggregations

RepositoryImpl (co.rsk.db.RepositoryImpl)62 Test (org.junit.Test)54 Repository (org.ethereum.core.Repository)25 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)22 RskAddress (co.rsk.core.RskAddress)19 TrieStoreImpl (co.rsk.trie.TrieStoreImpl)16 HashMapDB (org.ethereum.datasource.HashMapDB)15 co.rsk.bitcoinj.core (co.rsk.bitcoinj.core)13 org.ethereum.core (org.ethereum.core)13 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)12 LogInfo (org.ethereum.vm.LogInfo)12 SimpleRskTransaction (co.rsk.peg.simples.SimpleRskTransaction)11 BridgeConstants (co.rsk.config.BridgeConstants)10 BridgeEventLogger (co.rsk.peg.utils.BridgeEventLogger)10 DataWord (org.ethereum.vm.DataWord)9 ArrayList (java.util.ArrayList)8 BtcBlockStore (co.rsk.bitcoinj.store.BtcBlockStore)7 ECKey (org.ethereum.crypto.ECKey)7 Keccak256 (co.rsk.crypto.Keccak256)6 SimpleBlockChain (co.rsk.peg.simples.SimpleBlockChain)6