Skip to content

Commit e2d4b50

Browse files
committed
Clean up spent outputs after deleting stale mempool MRC txns
1 parent 3b5aa63 commit e2d4b50

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,16 @@ bool ReorganizeChain(CTxDB& txdb, unsigned &cnt_dis, unsigned &cnt_con, CBlock &
22932293
}
22942294
}
22952295

2296+
// Clean up spent outputs in wallet that are now not spent if mempool transactions erased above. This
2297+
// is ugly and heavyweight and should be replaced when the upstream wallet code is ported. Unlike the
2298+
// repairwallet rpc, this is silent.
2299+
if (!to_be_erased.empty()) {
2300+
int nMisMatchFound = 0;
2301+
CAmount nBalanceInQuestion = 0;
2302+
2303+
pwalletMain->FixSpentCoins(nMisMatchFound, nBalanceInQuestion);
2304+
}
2305+
22962306
if (!txdb.WriteHashBestChain(pindex->GetBlockHash()))
22972307
{
22982308
txdb.TxnAbort();

0 commit comments

Comments
 (0)