diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 7abd17d31e9..09eda0c28e4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1548,8 +1548,11 @@ void CWallet::blockDisconnected(const interfaces::BlockInfo& block) int disconnect_height = block.height; - for (const CTransactionRef& ptx : Assert(block.data)->vtx) { - SyncTransaction(ptx, TxStateInactive{}); + for (size_t index = 0; index < block.data->vtx.size(); index++) { + const CTransactionRef& ptx = Assert(block.data)->vtx[index]; + // Coinbase transactions are not only inactive but also abandoned, + // meaning they should never be relayed standalone via the p2p protocol. + SyncTransaction(ptx, TxStateInactive{/*abandoned=*/index == 0}); for (const CTxIn& tx_in : ptx->vin) { // No other wallet transactions conflicted with this transaction