Fixed CN mining getblocktemplate/submitblock hash values.

This commit is contained in:
Jianping Wu 2019-04-02 12:23:21 -07:00
parent bf158ae112
commit da5ce9ee09

View File

@ -931,7 +931,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
// Generate the merkle root as all the transactions (including coinbase) are known. // Generate the merkle root as all the transactions (including coinbase) are known.
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock); pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
uint256 blockHash = pblock->GetHash(); uint256 blockHash = pblock->GetOriginalBlockHash();
cryptonote::block cn_block; cryptonote::block cn_block;
// block_header // block_header
@ -1168,7 +1168,7 @@ UniValue submitblock(const JSONRPCRequest& request)
block.cnHeader.merkle_root = CryptoHashToUint256(tree_root_hash); block.cnHeader.merkle_root = CryptoHashToUint256(tree_root_hash);
block.cnHeader.nTxes = 1; // The Cryptonote coinbase tx. block.cnHeader.nTxes = 1; // The Cryptonote coinbase tx.
uint256 hash = block.GetHash(); uint256 hash = block.GetOriginalBlockHash();
// Cryptonote prev_id is used to store the block hash of kevacoin. // Cryptonote prev_id is used to store the block hash of kevacoin.
if (hash != block.cnHeader.prev_id) { if (hash != block.cnHeader.prev_id) {
throw CN_JSONRPCError(CORE_RPC_ERROR_CODE_WRONG_PARAM, "Kevacoin block hash does not match cryptnote hash"); throw CN_JSONRPCError(CORE_RPC_ERROR_CODE_WRONG_PARAM, "Kevacoin block hash does not match cryptnote hash");