HomePhabricator

Small fix to the node broadcast logic

Description

Small fix to the node broadcast logic

Summary:

Currently, if BroadcastTransaction() is called to rebroadcast a
transaction (e.g. by ResendWalletTransactions()), then we add the
transaction to the unbroadcast set. That transaction has already been
broadcast in the past, so peers are unlikely to request it again,
meaning RemoveUnbroadcastTx() won't be called and it won't be removed
from m_unbroadcast_txids.

Net processing will therefore continue to attempt rebroadcast for the
transaction every 10-15 minutes. This will most likely continue until
the node connects to a new peer which hasn't yet seen the transaction
(or perhaps indefinitely).

Fix by only adding the transaction to the broadcast set when it's added to the mempool.

Backport of core#22261.
Depends on D12204.

Only 3/5 commits are relevant to our codebase:
https://github.com/bitcoin/bitcoin/pull/22261/commits/2837a9f1eaa2c6bf402d1d9891d9aa84c4a56033
https://github.com/bitcoin/bitcoin/pull/22261/commits/847b6ed48d7bacec9024618922e9b339d2d97676
https://github.com/bitcoin/bitcoin/pull/22261/commits/5a77abd4e657458852875a07692898982f4b1db5

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D12206

Details

Provenance
FabienAuthored on Oct 11 2022, 13:22
FabienPushed on Oct 11 2022, 18:15
Reviewer
Restricted Project
Differential Revision
D12206: Small fix to the node broadcast logic
Parents
rABC77faa0b72eba: Move RelayProof to PeerManager
Branches
Unknown
Tags
Unknown