Fixed a couple incremental merkle tree bugs breaking consistency checks.

This commit is contained in:
Sean Bowe
2016-01-19 14:36:10 -07:00
parent 2c2dd2305e
commit cf47198370
3 changed files with 47 additions and 7 deletions
+1 -2
View File
@@ -1077,12 +1077,11 @@ bool CWallet::WitnessBucketCommitment(uint256 &commitment,
std::vector<bool> index;
std::vector<unsigned char> commitment_value(bucket_commitment.begin(), bucket_commitment.end());
libzerocash::convertBytesVectorToVector(commitment_value, commitment_bv);
tree.insertElement(commitment_bv, index);
assert(tree.insertElement(commitment_bv, index));
if (bucket_commitment == commitment) {
// We've found it! Now, we construct a witness.
res = true;
tree.prune();
commitment_index = index;
}
}