This commit is contained in:
Duke Leto
2020-06-17 10:41:33 -04:00
parent d0dade1d2c
commit 6e31ee3b1d
3 changed files with 9 additions and 4 deletions

View File

@@ -1721,14 +1721,17 @@ void CWallet::GetSaplingNoteWitnesses(std::vector<SaplingOutPoint> notes,
for (SaplingOutPoint note : notes) {
fprintf(stderr,"%s: i=%d\n", __func__,i);
auto noteData = mapWallet[note.hash].mapSaplingNoteData;
auto witnessess = noteData[note].witnesses;
if (mapWallet.count(note.hash) && noteData.count(note) && witnesses.size() > 0) {
fprintf(stderr,"%s: Found %lu witnesses for note %s\n", __func__, witnesses.size(), note.hash.ToString().c_str() );
witnesses[i] = witnesses.front();
auto nWitnesses = noteData[note].witnesses.size();
if (mapWallet.count(note.hash) && noteData.count(note) && nWitnesses > 0) {
fprintf(stderr,"%s: Found %lu witnesses for note %s\n", __func__, nWitnesses, note.hash.ToString().c_str() );
witnesses[i] = noteData[note].witnesses.front();
if (!rt) {
fprintf(stderr,"%s: Setting witness root\n",__func__);
rt = witnesses[i]->root();
} else {
if(*rt == witnesses[i]->root()) {
//fprintf(stderr,"%s: rt=%s\n",__func__,rt.GetHash().ToString().c_str());
//fprintf(stderr,"%s: witnesses[%d]->root()=%s\n",__func__,i,witnesses[i]->root().GetHash().ToString().c_str());
// Something is fucky
std::string err = "CWallet::GetSaplingNoteWitnesses: Invalid witness root! i=";
err += i;

View File

@@ -1018,6 +1018,7 @@ size_t IncrementalMerkleTree<Depth, Hash>::next_depth(size_t skip) const {
template<size_t Depth, typename Hash>
Hash IncrementalMerkleTree<Depth, Hash>::root(size_t depth,
std::deque<Hash> filler_hashes) const {
fprintf(stderr,"%s: depth=%d\n",__func__,depth);
PathFiller<Depth, Hash> filler(filler_hashes);
Hash combine_left = left ? *left : filler.next(0);

View File

@@ -1,3 +1,4 @@
// Copyright (c) 2019-2020 The Hush developers
#ifndef ZC_UTIL_H_
#define ZC_UTIL_H_