1 minor finding
Findings
[minor] · wait_until never calls the inbound-request predicate
The new barrier in test_inv_block returns immediately without checking that node 1 requested the transaction from a withholding inbound peer before advancing time toward expiry.
Location: test/functional/p2p_tx_download.py:143 (head).
Details and suggested fix
The lambda in self.wait_until(lambda: requested_tx_from_inbound) returns the function object, which is always truthy. The wait helper therefore returns on its first poll without evaluating the tx_getdata_count counters or their exactly-one-request condition. The preceding sync_with_ping() only synchronizes one connection, while the later inv_to_send assertion and sync_mempools() do not establish which peer was asked first. Consequently, the intended blocking-request and GETDATA_TX_INTERVAL fallback scenario remains unchecked; whether a run actually follows it depends on message scheduling. Pass the predicate directly as self.wait_until(requested_tx_from_inbound) so it is evaluated before the next clock advance, and confirm that the now-active predicate reliably succeeds after NONPREF_PEER_TX_DELAY.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The intended scenario was to request the transaction from an inbound peer that advertises it but withholds delivery, incur the GETDATA_TX_INTERVAL delay, and then obtain it through the honest outbound connection. Merely synchronizing mempools without encountering that blocking request was not the intended coverage.
The January 2025 repair explicitly explained that ignored manual announcements allowed this test to pass without asking an additional peer or triggering GETDATA_TX_INTERVAL. This directly establishes why selecting a blocking inbound peer before the honest fallback matters to the current timing change.
The timeout was designed to cover the worst-case initial inbound request delay, the interval until re-requesting from the outbound peer, and two seconds of race allowance. The honest announcement was a prerequisite, not an unconditional deadline guarantee: node 0 sees node 1 as inbound and may announce too late.
The desired adverse-case ordering is an inbound request first, followed by availability of the honest peer's announcement for the expiry-driven fallback. However, the historical comments expressly allowed uncertainty in announcement timing; they did not document a hard synchronization barrier placing that announcement before expiry.
Before the mock-time conversion, the test waited in sync_mempools(timeout=timeout). The February 2025 change instead froze only node 0's clock, advanced it by the whole timeout, and then used ordinary mempool synchronization. A later change checked that node 0's inventory queue was populated, triggered SendMessages through an unrelated peer, and checked that the queue drained, explicitly retaining the possibility of a rare announcement-timing failure.
This explains the enforcement inherited by the comparison base: wall-clock waiting was replaced by a single announcing-node clock jump plus announcement-queue checks, rather than separately advancing through inbound selection, announcement, and request expiry.
Ralph's inferences
The previous test arranged opportunities for the intended ordering rather than explicitly observing the entire sequence: it sent and ping-synchronized withholding-peer announcements before inserting the transaction into node 0's mempool, but did not wait for node 1's inbound GETDATA before advancing node 0's clock. Its inventory-queue assertions observed announcement progress, not inbound request selection.
The head's staged clock advances—NONPREF_PEER_TX_DELAY, then GETDATA_TX_INTERVAL minus one second, then the final second—express the intended sequence more explicitly: establish the blocking request, make the honest announcement available while that request is outstanding, and then reach expiry. That distinction identifies the historical coverage goal without assessing whether the revised implementation achieves it.