Make it work correctly
This commit is contained in:
@@ -880,13 +880,11 @@ UniValue getblockmerkletree(const UniValue& params, bool fHelp, const CPubKey& m
|
|||||||
}
|
}
|
||||||
|
|
||||||
phushblockindex = chainActive[nHeight];
|
phushblockindex = chainActive[nHeight];
|
||||||
blockRoot = phushblockindex->pprev->hashFinalSaplingRoot;
|
blockRoot = phushblockindex->hashFinalSaplingRoot;
|
||||||
if( pcoinsTip->GetSaplingAnchorAt(blockRoot, tree) ) {
|
if( pcoinsTip->GetSaplingAnchorAt(blockRoot, tree) ) {
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
ss << tree.path();
|
ss << tree;
|
||||||
std::vector<unsigned char> merklepath(ss.begin(), ss.end());
|
return HexStr(ss.begin(), ss.end());
|
||||||
//TODO: this returns the same, wrong data for all heights
|
|
||||||
return HexStr(merklepath);
|
|
||||||
} else {
|
} else {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find merkletree");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find merkletree");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ public:
|
|||||||
IncrementalWitness<Depth, Hash> witness() const {
|
IncrementalWitness<Depth, Hash> witness() const {
|
||||||
return IncrementalWitness<Depth, Hash>(*this);
|
return IncrementalWitness<Depth, Hash>(*this);
|
||||||
}
|
}
|
||||||
MerklePath path(std::deque<Hash> filler_hashes = std::deque<Hash>()) const;
|
|
||||||
|
|
||||||
ADD_SERIALIZE_METHODS;
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
@@ -136,6 +135,7 @@ private:
|
|||||||
|
|
||||||
// Collapsed "left" subtrees ordered toward the root of the tree.
|
// Collapsed "left" subtrees ordered toward the root of the tree.
|
||||||
std::vector<boost::optional<Hash>> parents;
|
std::vector<boost::optional<Hash>> parents;
|
||||||
|
MerklePath path(std::deque<Hash> filler_hashes = std::deque<Hash>()) const;
|
||||||
Hash root(size_t depth, std::deque<Hash> filler_hashes = std::deque<Hash>()) const;
|
Hash root(size_t depth, std::deque<Hash> filler_hashes = std::deque<Hash>()) const;
|
||||||
bool is_complete(size_t depth = Depth) const;
|
bool is_complete(size_t depth = Depth) const;
|
||||||
size_t next_depth(size_t skip) const;
|
size_t next_depth(size_t skip) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user