Make it work correctly

This commit is contained in:
Duke Leto
2022-02-16 09:10:11 -05:00
parent c8430665f7
commit ce5c8a54e4
2 changed files with 4 additions and 6 deletions

View File

@@ -880,13 +880,11 @@ UniValue getblockmerkletree(const UniValue& params, bool fHelp, const CPubKey& m
}
phushblockindex = chainActive[nHeight];
blockRoot = phushblockindex->pprev->hashFinalSaplingRoot;
blockRoot = phushblockindex->hashFinalSaplingRoot;
if( pcoinsTip->GetSaplingAnchorAt(blockRoot, tree) ) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << tree.path();
std::vector<unsigned char> merklepath(ss.begin(), ss.end());
//TODO: this returns the same, wrong data for all heights
return HexStr(merklepath);
ss << tree;
return HexStr(ss.begin(), ss.end());
} else {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find merkletree");
}