use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class LogFilterTest method twoEventsAfterTwoBlocksWithEventAndToLatestBlock.
@Test
public void twoEventsAfterTwoBlocksWithEventAndToLatestBlock() {
RskTestFactory factory = new RskTestFactory();
Blockchain blockchain = factory.getBlockchain();
BlockStore blockStore = factory.getBlockStore();
RepositoryLocator repositoryLocator = factory.getRepositoryLocator();
Web3ImplLogsTest.addEmptyBlockToBlockchain(blockchain, blockStore, repositoryLocator, factory.getTrieStore());
Block block = blockchain.getBestBlock();
AddressesTopicsFilter atfilter = new AddressesTopicsFilter(new RskAddress[0], null);
LogFilter filter = new LogFilter(atfilter, blockchain, false, true);
filter.newBlockReceived(block);
filter.newBlockReceived(block);
Object[] result = filter.getEvents();
Assert.assertNotNull(result);
Assert.assertEquals(2, result.length);
}
use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class LogFilterTest method onlyOneEventAfterTwoBlocksWithEventAndFromLatestBlock.
@Test
public void onlyOneEventAfterTwoBlocksWithEventAndFromLatestBlock() {
RskTestFactory factory = new RskTestFactory();
Blockchain blockchain = factory.getBlockchain();
BlockStore blockStore = factory.getBlockStore();
RepositoryLocator repositoryLocator = factory.getRepositoryLocator();
Web3ImplLogsTest.addEmptyBlockToBlockchain(blockchain, blockStore, repositoryLocator, factory.getTrieStore());
Block block = blockchain.getBestBlock();
AddressesTopicsFilter atfilter = new AddressesTopicsFilter(new RskAddress[0], null);
LogFilter filter = new LogFilter(atfilter, blockchain, true, true);
filter.newBlockReceived(block);
filter.newBlockReceived(block);
Object[] result = filter.getEvents();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.length);
}
use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class LogFilterTest method eventAfterBlockWithEvent.
@Test
public void eventAfterBlockWithEvent() {
RskTestFactory factory = new RskTestFactory();
Blockchain blockchain = factory.getBlockchain();
BlockStore blockStore = factory.getBlockStore();
RepositoryLocator repositoryLocator = factory.getRepositoryLocator();
Web3ImplLogsTest.addEmptyBlockToBlockchain(blockchain, blockStore, repositoryLocator, factory.getTrieStore());
Block block = blockchain.getBestBlock();
AddressesTopicsFilter atfilter = new AddressesTopicsFilter(new RskAddress[0], null);
LogFilter filter = new LogFilter(atfilter, blockchain, false, true);
filter.newBlockReceived(block);
Object[] result = filter.getEvents();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.length);
}
Aggregations