Repository navigation
private broadcast: wait synchronously for mempool acceptance - #36566
andrewtoth wants to merge 4 commits into
Conversation
Notify validation subscribers synchronously after queuing the existing mempool acceptance event. This allows acceptance waiters to wake independently of the background notification queue.
Subscribe before private broadcast submission and wait for local mempool acceptance, timeout, or shutdown. Synchronous acceptance notifications allow callers holding the wallet lock to wait without draining its notification queue.
Expose the private broadcast timeout in sendrawtransaction and default private broadcasts to a ten-minute wait.
1069474 to
bccae01
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Can we gather a list of these? Given the Core wallet motivation in part I think I'd like to see end to end wallet integration before stepping through this change. Naively done, it could end up with some dangerous behavior for users, such as:
sendtoaddress was never idempotent to begin with, which is kind of scary on its own, I just think this broadens the scope of possible loss through unclear UX. Users suddenly "losing" funds by stuff not being in mempool and not being accounted for will at least cause the users to slow down :/ |
|
🐙 This pull request conflicts with the target branch and needs rebase. |

Calling
BroadcastTransactionwith theNO_MEMPOOL_PRIVATE_BROADCASTmethod skips inserting the transaction into the mempool and returns immediately. This causes problems with software that expects the transaction to be in the mempool after the function returns. For example many third-party wallets or services callsendrawtransactionand expect the transaction to be in the mempool after it returns a successful response.This PR adds a new
TransactionAddedToMempoolSyncmethod toCValidationInterface. This is then used inBroadcastTransactionwhen the method isNO_MEMPOOL_PRIVATE_BROADCASTto wait for the transaction to have been accepted back into the mempool before returning. It also adds a timeout (default 10 minutes) toBroadcastTransactionand exposes it as an option forsendrawtransaction. Setting the timeout to 0 disables the wait and returns immediately, preserving the current behavior.Synchronously waiting for mempool acceptance is also a prerequisite for adding private broadcast support to the wallet. The
TransactionAddedToMempoolSyncmethod is added specifically for future wallet broadcasting, so a broadcast caller holdingcs_walletwill not timeout waiting on another background event that is also trying to acquirecs_wallet.