Skip to content

Commit a58bbb5

Browse files
committed
wallet: automatically abandon inactive coinbase tx and their descendants during startup
1 parent ae3e235 commit a58bbb5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/wallet/walletdb.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,13 @@ static DBErrors LoadTxRecords(CWallet* pwallet, DatabaseBatch& batch, std::vecto
11151115
});
11161116
result = std::max(result, order_pos_res.m_result);
11171117

1118+
// After loading all tx records, abandon any coinbase that is no longer in the active chain.
1119+
for (auto& [id, wtx] : pwallet->mapWallet) {
1120+
if (wtx.IsCoinBase() && wtx.isInactive()) {
1121+
pwallet->AbandonTransaction(wtx);
1122+
}
1123+
}
1124+
11181125
return result;
11191126
}
11201127

0 commit comments

Comments
 (0)