use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class MinerManagerTest method getMinerServer.
private static MinerServerImpl getMinerServer(Blockchain blockchain) {
SimpleEthereum ethereum = new SimpleEthereum();
ethereum.repository = blockchain.getRepository();
ethereum.blockchain = blockchain;
DifficultyCalculator difficultyCalculator = new DifficultyCalculator(config);
return new MinerServerImpl(config, ethereum, blockchain, null, difficultyCalculator, new ProofOfWorkRule(config).setFallbackMiningEnabled(false), new BlockToMineBuilder(ConfigUtils.getDefaultMiningConfig(), blockchain.getRepository(), blockchain.getBlockStore(), blockchain.getTransactionPool(), difficultyCalculator, new GasLimitCalculator(config), new BlockValidationRuleDummy(), config, null), ConfigUtils.getDefaultMiningConfig());
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class TxBuilderTest method createBasicTransaction.
@Test
public void createBasicTransaction() {
SimpleEthereum rsk = new SimpleEthereum();
TxBuilder builder = new TxBuilder(config, rsk, null, (Repository) rsk.repository);
BigInteger gasPrice = BigInteger.ONE;
BigInteger gasLimit = BigInteger.valueOf(21000);
BigInteger nonce = BigInteger.TEN;
Transaction tx = builder.createNewTransaction(gasPrice, gasLimit, nonce);
Assert.assertEquals(gasLimit, new BigInteger(1, tx.getGasLimit()));
Assert.assertEquals(gasPrice, tx.getGasPrice().asBigInteger());
Assert.assertEquals(nonce, new BigInteger(1, tx.getNonce()));
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class Web3ImplSnapshotTest method increaseTimeTwiceUsingDecimalValues.
@Test
public void increaseTimeTwiceUsingDecimalValues() {
World world = new World();
SimpleEthereum ethereum = new SimpleEthereum();
MinerServer minerServer = getMinerServerForTest(world, ethereum);
Web3Impl web3 = createWeb3(world, ethereum, minerServer);
web3.evm_increaseTime("16");
String result = web3.evm_increaseTime("16");
Assert.assertEquals("0x20", result);
Assert.assertEquals(32, minerServer.increaseTime(0));
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class Web3ImplSnapshotTest method increaseTimeTwice.
@Test
public void increaseTimeTwice() {
World world = new World();
SimpleEthereum ethereum = new SimpleEthereum();
MinerServer minerServer = getMinerServerForTest(world, ethereum);
Web3Impl web3 = createWeb3(world, ethereum, minerServer);
web3.evm_increaseTime("0x10");
String result = web3.evm_increaseTime("0x10");
Assert.assertEquals("0x20", result);
Assert.assertEquals(32, minerServer.increaseTime(0));
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class MinerManagerTest method getMinerServer.
private MinerServerImpl getMinerServer() {
SimpleEthereum ethereum = new SimpleEthereum();
ethereum.blockchain = blockchain;
DifficultyCalculator difficultyCalculator = new DifficultyCalculator(config.getActivationConfig(), config.getNetworkConstants());
MinerClock clock = new MinerClock(true, Clock.systemUTC());
MiningConfig miningConfig = ConfigUtils.getDefaultMiningConfig();
return new MinerServerImpl(config, ethereum, miningMainchainView, null, new ProofOfWorkRule(config).setFallbackMiningEnabled(false), new BlockToMineBuilder(config.getActivationConfig(), miningConfig, repositoryLocator, blockStore, transactionPool, difficultyCalculator, new GasLimitCalculator(config.getNetworkConstants()), new ForkDetectionDataCalculator(), new BlockValidationRuleDummy(), clock, blockFactory, blockExecutor, new MinimumGasPriceCalculator(Coin.valueOf(miningConfig.getMinGasPriceTarget())), new MinerUtils()), clock, blockFactory, new BuildInfo("cb7f28e", "master"), miningConfig);
}
Aggregations