use of co.rsk.mine.MinimumGasPriceCalculator in project rskj by rsksmart.
the class BlockGenerator method createBlock.
public Block createBlock(int number, int ntxs) {
Bloom logBloom = new Bloom();
Block parent = getGenesisBlock();
List<Transaction> txs = new ArrayList<>();
for (int ntx = 0; ntx < ntxs; ntx++) {
txs.add(new SimpleRskTransaction(null));
}
Coin previousMGP = parent.getMinimumGasPrice() != null ? parent.getMinimumGasPrice() : Coin.valueOf(10L);
Coin minimumGasPrice = new MinimumGasPriceCalculator().calculate(previousMGP, Coin.valueOf(100L));
return new Block(// parent hash
parent.getHash().getBytes(), // uncle hash
EMPTY_LIST_HASH, // coinbase
parent.getCoinbase().getBytes(), // logs bloom
logBloom.getData(), // difficulty
parent.getDifficulty().getBytes(), number, parent.getGasLimit(), parent.getGasUsed(), parent.getTimestamp() + ++count, // extraData
EMPTY_BYTE_ARRAY, // mixHash
EMPTY_BYTE_ARRAY, // provisory nonce
BigInteger.ZERO.toByteArray(), // receipts root
EMPTY_TRIE_HASH, // transaction receipts
EMPTY_TRIE_HASH, // state root
EMPTY_TRIE_HASH, // transaction list
txs, // uncle list
null, minimumGasPrice.getBytes(), Coin.ZERO);
}
Aggregations