rpc: fix successful broadcast count in `submitpackage` error msg #27127

pull theStack wants to merge 1 commits into bitcoin:master from theStack:202302-rpc-submitpackages_fix_broadcast_count changing 1 files +4 −3
  1. theStack commented at 12:45 AM on February 20, 2023: contributor

    If a submitpackage RPC call errors due to any of the individual tx broadcasts failing, the returned error message is supposed to contain the number of successful broadcasts so far:

    https://github.com/bitcoin/bitcoin/blob/4395b7f0845d2dca60f3b4e007ef5770ce8e2aa9/src/rpc/mempool.cpp#L848-L849

    Right now this is wrongly always shown as zero. Fix this by adding the missing increment of the counter. While touching that area, the variable is also renamed to better reflect its purpose (s/num_submitted/num_broadcast/; the submission has already happened at that point) and named arguments for the BroadcastTransaction call are added.

    (Note that the error should be really rare, as all txs have already been submitted succesfully to the mempool. IIUC this code-path could only hit if somehow a tx is being removed from the mempool between ProcessNewPackage and the BroadcastTransaction calls, e.g. if a new block is received which confirms any of the package's txs.)

  2. rpc: fix successful broadcast count in `submitpackage` error msg
    If a `submitpackage` RPC call errors due to any of the individual tx
    broadcasts failing, the returned error message is supposed to contain
    the number of successful broadcasts so far. Right now this is wrongly
    always shown as zero. Fix this by adding the missing counting.
    (Note though that the error should be really rare, as all txs have
    already been submitted succesfully to the mempool.)
    7554b1fd66
  3. DrahtBot commented at 12:45 AM on February 20, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK glozow

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label RPC/REST/ZMQ on Feb 20, 2023
  5. fanquake requested review from glozow on Feb 20, 2023
  6. glozow commented at 11:09 AM on February 20, 2023: member

    utACK 7554b1fd663fe2010edb0e8a93ab85a6cb10a323, thanks!

  7. fanquake merged this on Feb 20, 2023
  8. fanquake closed this on Feb 20, 2023

  9. theStack deleted the branch on Feb 20, 2023
  10. sidhujag referenced this in commit 18cb3aef1d on Feb 25, 2023
  11. bitcoin locked this on Feb 20, 2024

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-04-13 15:13 UTC

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