Merge bitcoin/bitcoin#32153: wallet: remove redundant Assert call when block is disconnected
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run

ae6b6ea296 wallet: remove redundant `Assert` call when block is disconnected (rkrux)

Pull request description:

  It was highlighted in a PR discussion previously that the recently moved `Assert` macro call inside the block disconnected loop had been redundant for quite a while because of the presence of the `assert` macro call at the start of the function. Therefore, it is removed now.

  refs #https://github.com/bitcoin/bitcoin/pull/31757#discussion_r1995416821

ACKs for top commit:
  fjahr:
    utACK ae6b6ea296
  l0rinc:
    crACK ae6b6ea296
  hodlinator:
    Code Review ACK ae6b6ea296
  Prabhat1308:
    Code Review ACK [`ae6b6ea`](ae6b6ea296)

Tree-SHA512: 6bbced88f4b39afcacefb7babe97c180a397d9cd55f18c4c2875bd594547dcdccb2059ac32495e0e8d4e7263b4c1349ca80b2f0fbd46b4450d1d847ba5abd903
This commit is contained in:
Ryan Ofsky 2025-03-28 11:13:35 -04:00
commit 9acc25bcb6
No known key found for this signature in database
GPG key ID: 46800E30FC748A66

View file

@ -1549,7 +1549,7 @@ void CWallet::blockDisconnected(const interfaces::BlockInfo& block)
int disconnect_height = block.height; int disconnect_height = block.height;
for (size_t index = 0; index < block.data->vtx.size(); index++) { for (size_t index = 0; index < block.data->vtx.size(); index++) {
const CTransactionRef& ptx = Assert(block.data)->vtx[index]; const CTransactionRef& ptx = block.data->vtx[index];
// Coinbase transactions are not only inactive but also abandoned, // Coinbase transactions are not only inactive but also abandoned,
// meaning they should never be relayed standalone via the p2p protocol. // meaning they should never be relayed standalone via the p2p protocol.
SyncTransaction(ptx, TxStateInactive{/*abandoned=*/index == 0}); SyncTransaction(ptx, TxStateInactive{/*abandoned=*/index == 0});