use of org.aion.rpc.types.RPCTypes.BlockTemplate in project aion by aionnetwork.
the class MiningRPCImplTest method getWorkTest.
@Test
public void getWorkTest() {
ChainHolder chainHolder = new AionChainHolder(AionImpl.instForTest(), accountManager);
rpcMethods = new RPCMethods(chainHolder);
final BlockTemplate blockTemplate = rpcMethods.getBlockTemplate();
assertNotNull(blockTemplate);
assertTrue(chainHolder.canSeal(blockTemplate.headerHash.toBytes()));
BlockTemplateConverter.encode(blockTemplate);
final Request request = buildRequest("getBlockTemplate", VoidParamsConverter.encode(new VoidParams()));
BlockTemplateConverter.encode(execute(request, BlockTemplateConverter::decode));
}
use of org.aion.rpc.types.RPCTypes.BlockTemplate in project aion by aionnetwork.
the class RPCMethods method getBlockTemplate.
@Override
public BlockTemplate getBlockTemplate() {
BlockContext context = chainHolder.getBlockTemplate();
MiningBlock block = context.block;
return new BlockTemplate(ByteArray.wrap(block.getParentHash()), block.getNumber(), block.getHeader().getPowBoundaryBI(), ByteArray.wrap(block.getHeader().getMineHash()), context.baseBlockReward, context.transactionFee);
}
Aggregations