Make the test pass by fixing the bug!
This commit is contained in:
parent
eeee6d5d6c
commit
9d2cc3a784
|
@ -756,16 +756,19 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||||
CNoteData* nd = &(item.second);
|
CNoteData* nd = &(item.second);
|
||||||
// Check the validity of the cache
|
// Check the validity of the cache
|
||||||
assert(nWitnessCacheSize >= nd->witnesses.size());
|
assert(nWitnessCacheSize >= nd->witnesses.size());
|
||||||
// Witnesses being decremented should always be either -1
|
// Only increment witnesses that are not above the current height
|
||||||
// (never incremented or decremented) or equal to pindex
|
if (nd->witnessHeight <= pindex->nHeight) {
|
||||||
assert((nd->witnessHeight == -1) ||
|
// Witnesses being decremented should always be either -1
|
||||||
(nd->witnessHeight == pindex->nHeight));
|
// (never incremented or decremented) or equal to pindex
|
||||||
if (nd->witnesses.size() > 0) {
|
assert((nd->witnessHeight == -1) ||
|
||||||
nd->witnesses.pop_front();
|
(nd->witnessHeight == pindex->nHeight));
|
||||||
|
if (nd->witnesses.size() > 0) {
|
||||||
|
nd->witnesses.pop_front();
|
||||||
|
}
|
||||||
|
// pindex is the block being removed, so the new witness cache
|
||||||
|
// height is one below it.
|
||||||
|
nd->witnessHeight = pindex->nHeight - 1;
|
||||||
}
|
}
|
||||||
// pindex is the block being removed, so the new witness cache
|
|
||||||
// height is one below it.
|
|
||||||
nd->witnessHeight = pindex->nHeight - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nWitnessCacheSize -= 1;
|
nWitnessCacheSize -= 1;
|
||||||
|
|
Loading…
Reference in New Issue