use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class MinerServerTest method setUp.
@Before
public void setUp() {
RskTestFactory factory = new RskTestFactory(config) {
@Override
protected RepositoryLocator buildRepositoryLocator() {
return Mockito.spy(super.buildRepositoryLocator());
}
};
blockchain = factory.getMiningMainchainView();
repositoryLocator = factory.getRepositoryLocator();
blockStore = factory.getBlockStore();
transactionPool = factory.getTransactionPool();
blockFactory = factory.getBlockFactory();
blockExecutor = factory.getBlockExecutor();
minimumGasPriceCalculator = new MinimumGasPriceCalculator(Coin.ZERO);
minerUtils = new MinerUtils();
}
use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class BlockChainImplTest method setup.
@Before
public void setup() {
objects = new RskTestFactory() {
@Override
protected GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "rsk-unittests.json", BigInteger.ZERO, true, true, true);
}
@Override
protected CompositeEthereumListener buildCompositeEthereumListener() {
return new BlockExecutorTest.SimpleEthereumListener();
}
};
config = objects.getRskSystemProperties();
blockChain = objects.getBlockchain();
blockStore = objects.getBlockStore();
blockExecutor = objects.getBlockExecutor();
listener = (BlockExecutorTest.SimpleEthereumListener) objects.getCompositeEthereumListener();
}
use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class MainNetMinerTest method setup.
@Before
public void setup() {
config = spy(new TestSystemProperties());
when(config.getNetworkConstants()).thenReturn(Constants.mainnet());
when(config.getActivationConfig()).thenReturn(ActivationConfigsForTest.all());
RskTestFactory factory = new RskTestFactory(config) {
@Override
public GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "rsk-unittests.json", BigInteger.ZERO, true, true, true) {
@Override
public Genesis load() {
Genesis genesis = super.load();
genesis.getHeader().setDifficulty(new BlockDifficulty(BigInteger.valueOf(300000)));
return genesis;
}
};
}
};
mainchainView = factory.getMiningMainchainView();
transactionPool = factory.getTransactionPool();
blockStore = factory.getBlockStore();
blockProcessor = factory.getNodeBlockProcessor();
repositoryLocator = factory.getRepositoryLocator();
blockFactory = factory.getBlockFactory();
blockExecutor = factory.getBlockExecutor();
}
use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class Web3ImplSnapshotTest method setUp.
@Before
public void setUp() {
factory = new RskTestFactory(config);
blockchain = factory.getBlockchain();
mainchainView = factory.getMiningMainchainView();
blockFactory = factory.getBlockFactory();
}
use of org.ethereum.util.RskTestFactory in project rskj by rsksmart.
the class BlockchainLoaderTest method testLoadBlockchainWithInconsistentBlock.
@Test
public void testLoadBlockchainWithInconsistentBlock() {
RskTestFactory objects = new RskTestFactory() {
@Override
protected synchronized RepositoryLocator buildRepositoryLocator() {
RepositoryLocator repositoryLocatorSpy = spy(super.buildRepositoryLocator());
doReturn(Optional.empty()).when(repositoryLocatorSpy).findSnapshotAt(any());
return repositoryLocatorSpy;
}
@Override
protected GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "blockchain_loader_genesis.json", BigInteger.ZERO, true, true, true);
}
};
try {
// calls loadBlockchain
objects.getBlockchain();
fail();
} catch (RuntimeException e) {
String errorMessage = String.format("Best block is not consistent with the state db. Consider using `%s` cli tool to rewind inconsistent blocks", RewindBlocks.class.getSimpleName());
assertEquals(errorMessage, e.getMessage());
}
}
Aggregations