use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class TwoNodeTest method createNode.
private static SimpleNode createNode(int size) {
final World world = new World();
final BlockStore store = new BlockStore();
final Blockchain blockchain = world.getBlockChain();
List<Block> blocks = new BlockGenerator().getBlockChain(blockchain.getBestBlock(), size);
for (Block b : blocks) blockchain.tryToConnect(b);
BlockNodeInformation nodeInformation = new BlockNodeInformation();
SyncConfiguration syncConfiguration = SyncConfiguration.IMMEDIATE_FOR_TESTING;
RskSystemProperties config = new RskSystemProperties();
BlockSyncService blockSyncService = new BlockSyncService(config, store, blockchain, nodeInformation, syncConfiguration);
NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService, syncConfiguration);
NodeMessageHandler handler = new NodeMessageHandler(new RskSystemProperties(), processor, null, null, null, null, null, new DummyBlockValidationRule());
return new SimpleNode(handler);
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class TxValidatorAccountBalanceValidatorTest method balanceIsNotValidatedIfFreeTx.
@Test
public void balanceIsNotValidatedIfFreeTx() {
Transaction tx = new Transaction(BigInteger.ZERO.toByteArray(), BigInteger.ONE.toByteArray(), BigInteger.valueOf(21071).toByteArray(), new ECKey().getAddress(), BigInteger.ZERO.toByteArray(), Hex.decode("0001"), new RskSystemProperties().getBlockchainConfig().getCommonConstants().getChainId());
tx.sign(new ECKey().getPrivKeyBytes());
TxValidatorAccountBalanceValidator tv = new TxValidatorAccountBalanceValidator();
Assert.assertTrue(tv.validate(tx, new AccountState(), BigInteger.ONE, Coin.valueOf(1L), Long.MAX_VALUE, true));
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class TransactionUtils method createTransaction.
public static Transaction createTransaction(byte[] privateKey, String toAddress, BigInteger value, BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit) {
Transaction tx = Transaction.create(new RskSystemProperties(), toAddress, value, nonce, gasPrice, gasLimit);
tx.sign(privateKey);
return tx;
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class FileBlockPlayerTest method createPlayer.
@Test
public void createPlayer() throws Exception {
FileBlockRecorder recorder = new FileBlockRecorder("testblocks.txt");
recorder.close();
FileBlockPlayer player = new FileBlockPlayer(new RskSystemProperties(), "testblocks.txt");
File file = new File("testblocks.txt");
Assert.assertTrue(file.exists());
Assert.assertNull(player.readBlock());
player.close();
Assert.assertTrue(file.delete());
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class WalletFactory method createPersistentWallet.
public static Wallet createPersistentWallet(String storeName) {
KeyValueDataSource ds = new LevelDbDataSource(new RskSystemProperties(), storeName);
ds.init();
return new Wallet(ds);
}
Aggregations