use of org.ethereum.core.genesis.GenesisLoader in project rskj by rsksmart.
the class BlockChainImplInvalidTest method setup.
@Before
public void setup() {
objects = new RskTestContext(new String[0]) {
@Override
protected synchronized RskSystemProperties buildRskSystemProperties() {
RskSystemProperties rskSystemProperties = super.buildRskSystemProperties();
ActivationConfig activationConfigSpy = spy(rskSystemProperties.getActivationConfig());
RskSystemProperties rskSystemPropertiesSpy = spy(rskSystemProperties);
doReturn(true).when(activationConfigSpy).isActive(eq(ConsensusRule.RSKIP126), anyLong());
doReturn(activationConfigSpy).when(rskSystemPropertiesSpy).getActivationConfig();
return rskSystemPropertiesSpy;
}
@Override
protected GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "rsk-unittests.json", BigInteger.ZERO, true, true, true);
}
@Override
public BlockValidator buildBlockValidator() {
return new BlockValidatorImpl(getBlockStore(), getBlockParentDependantValidationRule(), getBlockValidationRule());
}
};
blockChain = objects.getBlockchain();
}
use of org.ethereum.core.genesis.GenesisLoader 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.core.genesis.GenesisLoader in project rskj by rsksmart.
the class TransactionPoolImplTest method setUp.
@Before
public void setUp() {
rskTestContext = new RskTestContext(new String[] { "--regtest" }) {
@Override
protected GenesisLoader buildGenesisLoader() {
return new TestGenesisLoader(getTrieStore(), "rsk-unittests.json", BigInteger.ZERO, true, true, true);
}
@Override
protected RepositoryLocator buildRepositoryLocator() {
return spy(super.buildRepositoryLocator());
}
};
blockChain = rskTestContext.getBlockchain();
RepositoryLocator repositoryLocator = rskTestContext.getRepositoryLocator();
repository = repositoryLocator.startTrackingAt(blockChain.getBestBlock().getHeader());
signatureCache = spy(rskTestContext.getReceivedTxSignatureCache());
transactionPool = new TransactionPoolImpl(rskTestContext.getRskSystemProperties(), repositoryLocator, rskTestContext.getBlockStore(), rskTestContext.getBlockFactory(), rskTestContext.getCompositeEthereumListener(), rskTestContext.getTransactionExecutorFactory(), signatureCache, 10, 100);
// don't call start to avoid creating threads
transactionPool.processBest(blockChain.getBestBlock());
// this is to workaround the current test structure, which abuses the Repository by
// modifying it in place
doReturn(repository).when(repositoryLocator).snapshotAt(any());
}
Aggregations