From adb3502f77e16e48ecb7113195dc7c2e7c3c5a33 Mon Sep 17 00:00:00 2001 From: Jianping Wu Date: Thu, 7 Mar 2019 17:32:08 -0800 Subject: [PATCH] WIP: HexStr the template blob. --- src/rpc/mining.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index beeba7404..d45456489 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -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.