Merge bitcoin/bitcoin#27864: test: fix intermittent failure in p2p_leak_tx.py

ee2417ed614d6a298f932ac068702ab2abee3cdf test: fix intermittent failure in p2p_leak_tx.py (Martin Zumsande)

Pull request description:

  Fixes #27860

  The problem was that the replacement tx `tx_b` would sometimes be sent out to the inbound peer after the `notfound`, so that threre  would be an unexpected `tx` message and the test fails.

  ```
   node0 2023-06-12T12:48:24.903204Z [msghand] [net.cpp:2856] [PushMessage] [net] sending notfound (73 bytes) peer=1
   node0 2023-06-12T12:48:24.903916Z [msghand] [net.cpp:2856] [PushMessage] [net] sending tx (133 bytes) peer=1
                                       File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_leak_tx.py", line 74, in test_notfound_on_replaced_tx
                                         assert "tx" not in inbound_peer.last_message

  ```

  Fix this by letting the peer wait for the initial broadcast of the replacement tx before continuing with the test.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK ee2417ed614d6a298f932ac068702ab2abee3cdf

Tree-SHA512: ecc8fb44cac6097a949e4ee622f6f654f49851d7966359532ab3af4c5ed9d587bf08110820b473a616cde3ae6fc8d0da9bb3cee39347655a8c433e819d4d1065
This commit is contained in:
fanquake 2023-06-13 09:28:26 +01:00
commit 8de9bb7a5a
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -57,6 +57,7 @@ class P2PLeakTxTest(BitcoinTestFramework):
tx_b = tx_a["tx"]
tx_b.vout[0].nValue -= 9000
self.gen_node.sendrawtransaction(tx_b.serialize().hex())
inbound_peer.wait_until(lambda: "tx" in inbound_peer.last_message and inbound_peer.last_message.get("tx").tx.getwtxid() == tx_b.getwtxid())
self.log.info("Re-request of tx_a after replacement is answered with notfound")
req_vec = [