Skip to content

wallet: extend -walletbroadcast to allow initial send only - #36380

Open
vasild wants to merge 1 commit into
bitcoin:masterfrom
vasild:walletrebroadcast
Open

vasild wants to merge 1 commit into
bitcoin:masterfrom
vasild:walletrebroadcast

Conversation

@vasild

@vasild vasild commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

-walletbroadcast was a boolean 0 or 1 meaning either "do not broadcast transactions or "initial broadcast plus periodic re-broadcast (every 12-36 hours)".

Add a new possible value initialonly which would allow the user to configure the wallet to do the initial broadcast only and not to do the periodic rebroadcasts.

No new configuration options and no change in default behavior.

@DrahtBot

DrahtBot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept NACK achow101

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36897 (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
  • #36481 (wallet, rpc, gui: Allow users to manually rebroadcast a wallet transaction by achow101)
  • #36398 (wallet: only rebroadcast transactions originating from the wallet by mzumsande)
  • #35786 (wallet: drop spent parents redundant cache invalidation and notification by furszy)
  • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)

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.

@DrahtBot

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/36546473252/job/109333967547
LLM reason (✨ experimental): CI failed because the lint “doc” check detected undocumented command-line arguments: -walletbroadcast and -walletrebroadcast (AssertionError).

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

Comment thread src/wallet/wallet.h Resolved
@w0xlt

w0xlt commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Can we safely disable wallet re-broadcasting? If so, why do we need re-broadcasting at all?

Even if we choose this approach, I think extending -walletbroadcast with new modes would be cleaner than introducing another parameter with a very similar name.

@vasild

vasild commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Can we safely disable wallet re-broadcasting?

I think yes. Most users don't need it, but are nevertheless exposed to the privacy leaks it brings even if they never use it.

If so, why do we need re-broadcasting at all?

It serves this scenario:

  • The user creates a transaction in the wallet and broadcasts it to the network. So far so good.
  • The transaction is not very high fee so is not mined immediately.
  • Global mempool pressure increases and that causes the transaction to be evicted from everybody's mempools.
  • Global mempool pressure decreases.
  • Nobody knows about the transaction, except the user that created it.
  • It would have been mined if miners where aware of it but is never mined because the network "forgot" about it. In this case the user rebroadcasting the transaction would help.

Up to your judgement if this is rare or not, but is good to have wallet rebroadcast in such cases.

Even if we choose this approach, I think extending -walletbroadcast with new modes would be cleaner than introducing another parameter with a very similar name.

Hmm, sounds like something worth considering. Currently -walletbroadcast is a boolean. What would you suggest? Something like this maybe:

  • 0 no initial, no rebroadcast
  • 1 initial and rebroadcast
  • initialonly initial, no rebroadcast

?

@mzumsande

Copy link
Copy Markdown
Contributor

I opened #36398 for a fix escpecially targeted at #3828, which doesn't have an option. One thing to note is that if we disable rebroadcast, we should probably also disable artificial resubmission to mempool (as explained there).

@achow101

achow101 commented Oct 1, 2026

Copy link
Copy Markdown
Member

I've opened #36403 where we can have more high level discussion about transaction rebroadcast in general.

@achow101

achow101 commented Oct 1, 2026

Copy link
Copy Markdown
Member

The new -walletrebroadcast is introduced with a default to false, which is a change in the default behavior.

Concept NACK

Disabling rebroadcasts by default has bad effects for the wallet.

@vasild

vasild commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

57cbe86d86733d95d116c84a880c70c15dc99562...155eb27489f4fdbf9570dfb064e36fa12f37f399: don't introduce a new option, instead extend the allowed values of -walletbroadcast.

Concept NACK
Disabling rebroadcasts by default has bad effects for the wallet.

Changed the PR. Now the default behavior is unmodified.

Now this PR allows -walletbroadcast=initialonly (in addition to the existent 0 and 1) to instruct it to only do the initial broadcasts and skip the periodic rebroadcasts.

`-walletbroadcast` was a boolean `0` or `1` meaning either "do not
broadcast transactions or "initial broadcast plus periodic
re-broadcast (every 12-36 hours)".

Add a new possible value `initialonly` which would allow the user to
configure the wallet to do the initial broadcast only and not to do the
periodic rebroadcasts.

No new configuration options and no change in default behavior.
@vasild

vasild commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

155eb27489f4fdbf9570dfb064e36fa12f37f399...17bad7c1073dc22d6dd8596e3786b0a01236db16: rebase due to conflicts

Concept NACK
Disabling rebroadcasts by default has bad effects for the wallet.

@achow101, this PR does not disable rebroadcasts by default anymore. Just adds the possibility to switch them off. No changes in default behavior and no new config options. Would you reevaluate your NACK?

I think the option to disable automatic wallet rebroadcasts (this PR) would click well with the possibility to manually rebroadcast desired transactions (#36481).

#36398 is very much related to this, it disables the automatic wallet rebroadacast based on whether the wallet is sender or receiver. So we have:

  1. Initial wallet broadcast (obviously, the wallet is the sender)
  2. Subsequent automatic periodic rebroadcast if wallet is sender of the transaction
  3. Subsequent automatic periodic rebroadcast if wallet is recipient of the transaction

Right now -walletbroadcast=0 disables all and =1 enables all.
This PR makes it possible to optionally disable 2 & 3, via -walletbroadcast=initialonly
#36398 disables 3, unconditionally. @mzumsande what about making that configurable via e.g. -walletbroadcast=senderonly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants