Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UniValue arr(UniValue::VARR);
- for (int i = 0; i < request.params[0].get_int(); i++) {
- std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseDest));
- if (!pblocktemplate.get())
- throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet keypool empty");
- unsigned int nExtraNonce = 0;
- IncrementExtraNonce(&pblocktemplate->block, chainActive.Tip(), nExtraNonce);
- if (!CheckProof(pblocktemplate->block, Params().GetConsensus()))
- throw JSONRPCError(RPC_METHOD_NOT_FOUND, "This method cannot be used with a block-signature-required chain");
- std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(pblocktemplate->block);
- bool ret;
- ret = ProcessNewBlock(Params(), shared_pblock, true, NULL);
- assert(ret);
- assert(chainActive.Tip()->GetBlockHash() == pblocktemplate->block.GetHash());
- arr.push_back(pblocktemplate->block.GetHash().ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement