wallet: resubmit transactions with private broadcast if enabled #34533

pull vasild wants to merge 2 commits into bitcoin:master from vasild:wallet_rebroadcast_use_private changing 2 files +47 −11
  1. vasild commented at 5:35 am on February 7, 2026: contributor

    The wallet keeps track of transactions related to it and periodically rebroadcasts them every 12-36 hours if they are not mined.

    If -privatebroadcast=1 and a transaction is submitted locally with the sendrawtransaction RPC and it is related to the wallet, then the rebroadcasts would use the send-to-all method. Change that to use the private broadcast method.

  2. wallet: improve log message
    The log message "Submitting wtx %s" might be misleading because the
    printed value is the txid, not wtxid.
    
    Change that to print both: "txid=%s wtxid=%s".
    
    Also, include the outcome of the submit which is useful for the one
    caller that does not print the error string.
    89c2fd55a5
  3. DrahtBot added the label Wallet on Feb 7, 2026
  4. DrahtBot commented at 5:35 am on February 7, 2026: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK pablomartin4btc, w0xlt

    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:

    • #34457 (wallet: add private broadcast support for wallet transactions by w0xlt)
    • #34359 (test: add test for rebroadcast of transaction received via p2p by mzumsande)
    • #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.

  5. wallet: resubmit transactions with private broadcast if enabled
    The wallet keeps track of transactions related to it and periodically
    rebroadcasts them every 12-36 hours if they are not mined.
    
    If `-privatebroadcast=1` and a transaction is submitted locally with the
    `sendrawtransaction` RPC and it is related to the wallet, then the
    rebroadcasts would use the send-to-all method. Change that to use the
    private broadcast method.
    a374c53b8d
  6. in src/wallet/wallet.cpp:30 in f3976dfda1 outdated
    26@@ -27,6 +27,7 @@
    27 #include <key.h>
    28 #include <key_io.h>
    29 #include <logging.h>
    30+#include <net.h>
    


    vasild commented at 5:38 am on February 7, 2026:

    This is just for the constant DEFAULT_PRIVATE_BROADCAST. Is there a better place for it? It is used in the following files:

    0src/init.cpp
    1src/net.cpp
    2src/net_processing.h
    3src/rpc/mempool.cpp
    4src/wallet/wallet.cpp (new in this PR)
    
  7. vasild force-pushed on Feb 7, 2026
  8. DrahtBot added the label CI failed on Feb 7, 2026
  9. DrahtBot commented at 5:43 am on February 7, 2026: contributor

    🚧 At least one of the CI tasks failed. Task lint: https://github.com/bitcoin/bitcoin/actions/runs/21775023286/job/62830040562 LLM reason (✨ experimental): Linting Python code failed (ruff) due to an extraneous f-string without placeholders in wallet_resendwallettransactions.py.

    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.

  10. pablomartin4btc commented at 6:13 pm on February 7, 2026: member

    Concept ACK.

    This is necessary to support the private transaction broadcast mechanism introduced in #29415 when transactions are rebroadcast or resubmitted, which does not seem to be handled currently.

  11. w0xlt commented at 4:55 am on February 8, 2026: contributor

    Concept ACK — though I am not sure this is the best long-term approach. However, it could work as a pragmatic short-term solution if we need something quickly.

    One concern with the approach here is that if a user uses sendrawtransaction to submit a wallet-related transaction while -privatebroadcast is enabled and then restarts the node without -privatebroadcast, the transaction would be rebroadcast via mempool since there is no per-transaction tracking of how it was originally sent.

    This is being discussed further here: #34457 (comment). As mentioned there, a possible alternative could be for the wallet to treat all IsFromMe() transactions not originated through CommitTransaction() as private by default (that PR introduces a private flag in CWalletTx::mapValue) and only allow rebroadcasting when -privatebroadcast is enabled.

  12. DrahtBot removed the label CI failed on Feb 9, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-02-10 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me