net: Do not add transaction reported as TX_CONSENSUS to the extrapool #36734

pull polespinasa wants to merge 1 commits into bitcoin:master from polespinasa:2026-11-02-excludeconsensusinvalidtxsfromextrapool changing 2 files +3 −2
  1. polespinasa commented at 9:02 PM on November 2, 2026: member

    The extrapool is only used to help reconstruct compact blocks with transactions that for some reason do not fit in our mempool, including consensus invalid transactions.

    This small PR excludes the ones initially reported as TX_CONSENSUS from being added to the extrapool, without performing additional validation, as they are not useful to reconstruct consensus valid blocks.

    Note that this path does not exclude all consensus invalid transactions. Consensus invalid transactions rejected under other categories remain unaffected and are still added to the extrapool. For example an invalid signature can be reported as TX_NOT_STANDARD during mempool script checks, or remain undetected if validation stops earlier for some other reason such as insufficient fees.

    Note that transactions with unknown inputs (orphans) are not treated as consensus invalid as validity cannot be fully determined.

    Avoiding all consensus invalid transactions to be included into the extrapool might not be worth the complexity and validation cost, potentially some extra-script verification steps would be needed.

    A possible future improvement could be to manage policy-rejected transactions and transactions removed through replacement separately. But this is outside the scope of this PR, which intends to be a small and simple patch.

    To be clear I don't think this is a vulnerability or a regression in the code, I don't think it can be abused by a malicious node trying to DoS us. It's just a small improvement to increase the utility of the extrapool.

  2. net: Do not add consensus invalid transactions to extrapool 7bc757ce87
  3. DrahtBot added the label P2P on Nov 2, 2026
  4. DrahtBot commented at 9:02 PM on November 2, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK ismaelsadeeq, sedited, darosior, instagibbs

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. polespinasa renamed this:
    net: Do not add consensus invalid transactions to the extrapool
    net: Do not add transaction reported as TX_CONSENSUS to the extrapool
    on Nov 2, 2026
  6. instagibbs commented at 11:00 PM on November 2, 2026: member

    concept ack

  7. ismaelsadeeq approved
  8. ismaelsadeeq commented at 9:46 AM on November 3, 2026: member

    ACK 7bc757ce87bfb5f654a4039e453c7f1fdbd744cf

  9. sedited approved
  10. sedited commented at 12:42 PM on November 6, 2026: contributor

    ACK 7bc757ce87bfb5f654a4039e453c7f1fdbd744cf

  11. sedited requested review from darosior on Nov 6, 2026
  12. fanquake added this to the milestone 33.0 on Dec 1, 2026
  13. fanquake commented at 3:27 PM on December 1, 2026: member

    ping @darosior

  14. darosior commented at 7:03 PM on December 1, 2026: member

    Seems fine to do, since it's there and clearly these are pointless to add to the extrapool. (To be clear: crACK 7bc757ce87bfb5f654a4039e453c7f1fdbd744cf). But i wonder if this might set an expectation that we should be able to distinguish standardness failures from consensus ones, which we cannot do comprehensively, and certainly not in an adversarial scenario.

    Because this does not apply in adversarial scenarii, this only helps in cases where a broken peer fills our extrapool with transactions we report as consensus invalid. I'm curious what prompted this PR. Did you notice that in the wild? [^1]

    If so, could you update the comment to state this is merely an opportunistic check, so we don't treat as a regression a possible future change in the reported cause?

    [^1]: Checking BNOC gives one recent type of broken peer where 2 of its 18 invalid transactions would have been reported as TX_CONSENSUS. Not much, but i suppose still a win.

  15. polespinasa commented at 7:57 PM on December 1, 2026: member

    I'm curious what prompted this PR. Did you notice that in the wild?

    Not really, we discovered this behavior with David while trying to come with some optimizations to speed up the block reconstruction using the mempool and extrapool (this was somewhere autumn 2025).

    During a conversation in 2140 during research week we mentioned this behavior again and there was some agreement in the room that we should probably fix it, but then I found it is not a straight forward fix so I ended up with this small improvement for now.

    If so, could you update the comment to state this is merely an opportunistic check, so we don't treat as a regression a possible future change in the reported cause?

    I've added a small comment in the PR description.

  16. fanquake commented at 10:36 AM on December 2, 2026: member

    concept ack @instagibbs any further thoughts?

  17. instagibbs commented at 2:35 PM on December 2, 2026: member

    ACK https://github.com/bitcoin/bitcoin/pull/36734/commits/7bc757ce87bfb5f654a4039e453c7f1fdbd744cf

    nit: The commit message should probably say TX_CONSENSUS, not all consensus

  18. sedited merged this on Dec 3, 2026
  19. sedited closed this on Dec 3, 2026

  20. polespinasa deleted the branch on Dec 3, 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-12-05 04:51 UTC

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