Browse Source

WIP: HexStr the template blob.

cn_merge
Jianping Wu 5 years ago
parent
commit
adb3502f77
  1. 5
      src/rpc/mining.cpp

5
src/rpc/mining.cpp

@ -955,12 +955,15 @@ UniValue getblocktemplate(const JSONRPCRequest& request) @@ -955,12 +955,15 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
if (!cryptonote::append_keva_block_to_extra(cn_block.miner_tx.extra, extra_keva_block)) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Internal error: failed to add block");
}
cryptonote::blobdata template_blob = cryptonote::block_to_blob(cn_block);
std::string hex_template_blob = HexStr(template_blob.begin(), template_blob.end());
UniValue result(UniValue::VOBJ);
const uint64_t difficulty = ConvertNBitsToDiff(pblock->nBits);
result.push_back(Pair("blocktemplate_blob", pblock->hashPrevBlock.GetHex()));
result.push_back(Pair("blocktemplate_blob", hex_template_blob));
result.push_back(Pair("difficulty", (double)difficulty));
result.push_back(Pair("height", (uint64_t)height));
result.push_back(Pair("prev_hash", pblock->hashPrevBlock.GetHex()));
result.push_back(Pair("reserved_offset", (uint64_t)reserved_offset));
// Kevacoin specific entries. Not used for now and may be useful in the future.

Loading…
Cancel
Save