Add more asserts to track down the bug
This commit is contained in:
committed by
Daira Hopwood
parent
ec8dc3a88a
commit
83d7b5b67b
@@ -675,6 +675,8 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
|
|||||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
||||||
CNoteData* nd = &(item.second);
|
CNoteData* nd = &(item.second);
|
||||||
|
// Check the validity of the cache
|
||||||
|
assert(nWitnessCacheSize >= nd->witnesses.size());
|
||||||
if (nd->witnesses.size() > 0) {
|
if (nd->witnesses.size() > 0) {
|
||||||
nd->witnesses.front().append(note_commitment);
|
nd->witnesses.front().append(note_commitment);
|
||||||
}
|
}
|
||||||
@@ -695,6 +697,13 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
|
|||||||
if (nWitnessCacheSize < WITNESS_CACHE_SIZE) {
|
if (nWitnessCacheSize < WITNESS_CACHE_SIZE) {
|
||||||
nWitnessCacheSize += 1;
|
nWitnessCacheSize += 1;
|
||||||
}
|
}
|
||||||
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
|
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
||||||
|
CNoteData* nd = &(item.second);
|
||||||
|
// Check the validity of the cache
|
||||||
|
assert(nWitnessCacheSize >= nd->witnesses.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (fFileBacked) {
|
if (fFileBacked) {
|
||||||
CWalletDB walletdb(strWalletFile);
|
CWalletDB walletdb(strWalletFile);
|
||||||
WriteWitnessCache(walletdb);
|
WriteWitnessCache(walletdb);
|
||||||
@@ -709,12 +718,21 @@ void CWallet::DecrementNoteWitnesses()
|
|||||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
||||||
CNoteData* nd = &(item.second);
|
CNoteData* nd = &(item.second);
|
||||||
|
// Check the validity of the cache
|
||||||
|
assert(nWitnessCacheSize >= nd->witnesses.size());
|
||||||
if (nd->witnesses.size() > 0) {
|
if (nd->witnesses.size() > 0) {
|
||||||
nd->witnesses.pop_front();
|
nd->witnesses.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nWitnessCacheSize -= 1;
|
nWitnessCacheSize -= 1;
|
||||||
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
|
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
||||||
|
CNoteData* nd = &(item.second);
|
||||||
|
// Check the validity of the cache
|
||||||
|
assert(nWitnessCacheSize >= nd->witnesses.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
// TODO: If nWitnessCache is zero, we need to regenerate the caches (#1302)
|
// TODO: If nWitnessCache is zero, we need to regenerate the caches (#1302)
|
||||||
assert(nWitnessCacheSize > 0);
|
assert(nWitnessCacheSize > 0);
|
||||||
if (fFileBacked) {
|
if (fFileBacked) {
|
||||||
|
|||||||
Reference in New Issue
Block a user