Skip to content

#386 follow-ups: deferred review findings (per-peer validation budget) #401

Open

Description

@kiwidream

Follow-ups from the review of #386 (head 362286cc88). None of them argues against merging it: it bounds a cost that is unbounded today, and it never disconnects a peer.

  • Peers on older versions are charged for transactions that only the new policy rejects. TX_NOT_STANDARD is charged (IsTxValidationTimeCharged). A v1.0.0 node accepts and relays a spend that v1.0.1 rejects under the policy: bound P2MR runtime stack bytes #263 stack-byte rule; the v1.0.1 node charges the first peer that delivers it (about 0.5 ms each in a regtest run with a v1.0.0 node as the relaying peer). At the default budget it takes many such transactions to throttle an established peer, and the peer stays connected, but while it is throttled its announcements are not requested from it. The PR body says such a peer is "at worst throttled". Options: do not charge failures of policy-only script flags that are new in the same release; or keep a throttled peer's announcements as low-priority candidates instead of dropping them. Either way the notes should say it in one sentence.
  • A new connection depends on the shared pool for its first 200 seconds. A peer can use its own credit only once it has reached the 100 ms cap (CanUseOwnCredit, RefillAccount), which takes 200 s at the default rate. Until then MayValidate is true only while the node-wide pool is above zero. While the pool is empty, the transactions of every such peer are dropped and its announcements ignored, even if it never sent a rejected transaction; after a restart that is every peer. Options: give a new connection a small initial credit; or let a peer with no charged time validate while the pool is empty.
  • Throttling is under-reported. While a peer is throttled the node mostly stops requesting from it, so tx_dropped_while_throttled stays at or near zero while announcements are being ignored and due requests released (the LogDebug at the release is the only trace). The field's help text is accurate, but it is the only visible measure. Option: count ignored announcements and released requests, or say in the notes that throttling mainly works by not requesting.
  • No functional run under DEBUG_LOCKORDER yet. In net: budget per-peer time spent validating rejected transactions #386's Full Validation the only DEBUG_LOCKORDER job (no IPC, i686, DEBUG; job 130047108088) failed in test_qbit-qt before it reached the functional suite, on a Qt test timing bound that net: budget per-peer time spent validating rejected transactions #386 does not touch. The unit tests passed in that job (peerman_tests, tx_validation_budget_tests), but p2p_tx_validation_budget.py has not run there. Re-run that job before merging.

Related: #275, #263.

Found in the 2026-11-10 review of the v1.0.1 change set. Code references are to 1.x.x at 9fc25e0268 unless stated.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions