test: tx orphan handling #28199

pull glozow wants to merge 2 commits into bitcoin:master from glozow:2023-08-test-orphan-handling changing 4 files +441 −0
  1. glozow commented at 11:14 am on August 2, 2023: member

    I was doing some mutation testing (through reckless refactoring) locally and found some specific behaviors in orphan handling that weren’t picked up by tests. Adding some of these test cases now can maybe help with reviewing refactors like #28031.

    • Parent requests aren’t sent immediately. A delay is added and the requests are filtered by AlreadyHaveTx before they are sent, which means you can’t use fake orphans to probe precise arrival timing of a tx.
    • Parent requests include all that are not AlreadyHaveTx. This means old confirmed parents may be requested.
    • The node does not give up on orphans if the peer responds to a parent request with notfound. This means that if a parent is an old confirmed transaction (in which notfound is expected), the orphan should still be resolved.
    • Rejected parents can cause an orphan to be dropped, but it depends on the reason and only based on txid.
    • Rejected parents can cause an orphan to be rejected too, by both wtxid and txid.
    • Requests for orphan parents should be de-duplicated with “regular” txrequest. If a missing parent has the same hash as an in-flight request, it shouldn’t be requested.
    • Multiple orphans with overlapping parents should not cause duplicated parent requests.
  2. glozow added the label Tests on Aug 2, 2023
  3. DrahtBot commented at 11:14 am on August 2, 2023: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK dergoegge, achow101, fjahr, instagibbs
    Concept ACK jamesob, brunoerg, jonatack, Empact, ajtowns

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20892 (tests: Run both descriptor and legacy tests within a single test invocation by achow101)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. DrahtBot renamed this:
    functional test: tx orphan handling
    test: tx orphan handling
    on Aug 2, 2023
  5. glozow force-pushed on Aug 2, 2023
  6. DrahtBot added the label CI failed on Aug 2, 2023
  7. dergoegge commented at 11:54 am on August 2, 2023: member

    Concept ACK

    Good to have these tests prior to refactoring

  8. jamesob commented at 12:29 pm on August 2, 2023: member
    Concept ACK, looks like some great additional coverage.
  9. brunoerg commented at 12:46 pm on August 2, 2023: contributor
    Concept ACK
  10. DrahtBot removed the label CI failed on Aug 2, 2023
  11. jonatack commented at 1:22 pm on August 2, 2023: contributor
    Concept ACK
  12. in test/functional/p2p_orphan_handling.py:6 in 29ec234654 outdated
    0@@ -0,0 +1,439 @@
    1+#!/usr/bin/env python3
    2+# Copyright (c) 2022 The Bitcoin Core developers
    3+# Distributed under the MIT software license, see the accompanying
    4+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    5+"""
    6+- A delay is added to parent requests because they are by txid.
    


    instagibbs commented at 4:14 pm on August 2, 2023:
    comment block seems extraneous if there’s logging for each test

    glozow commented at 8:23 am on August 3, 2023:
    removed comment block
  13. in test/functional/p2p_orphan_handling.py:57 in 29ec234654 outdated
    52+# to an inv(tx), in seconds. This delay includes all possible delays + 1, so it should only be used
    53+# when the value of the delay is not interesting. If we want to test that the node waits x seconds
    54+# for one peer and y seconds for another, use specific values instead.
    55+TXREQUEST_TIME_SKIP = NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY + OVERLOADED_PEER_TX_DELAY + 1
    56+
    57+# Time to fastfoward (using setmocktime) in between subtests to ensure they do not interfere with
    


    instagibbs commented at 5:17 pm on August 2, 2023:
    Stick the constant inside cleanup and move the comment for cleanup, since it explains what the whole thing is doing.

    glozow commented at 8:24 am on August 3, 2023:
    Done
  14. in test/functional/p2p_orphan_handling.py:258 in 29ec234654 outdated
    253+
    254+        # Relay the child. It should not be accepted because it has missing inputs.
    255+        self.relay_transaction(peer2, child_invalid_witness["tx"])
    256+        assert child_invalid_witness["txid"] not in node.getrawmempool()
    257+
    258+        # The parent should be requested. Delayed because it's by txid and this is not a preferred relay peer.
    


    instagibbs commented at 5:44 pm on August 2, 2023:
    0        # The parent should be requested since the unstripped wtxid would differ. Delayed because it's by txid and this is not a preferred relay peer.
    

    glozow commented at 9:07 am on August 3, 2023:
    Added
  15. in test/functional/p2p_orphan_handling.py:256 in 29ec234654 outdated
    275+        self.generate(self.wallet, 10)
    276+
    277+        # Create a fake reorg to trigger BlockDisconnected, which resets the rolling bloom filter.
    278+        # The alternative is to mine thousands of transactions to push it out of the filter.
    279+        last_block = node.getbestblockhash()
    280+        node.invalidateblock(last_block)
    


    instagibbs commented at 5:53 pm on August 2, 2023:
    can’t we just reconsider it again?

    glozow commented at 9:32 am on August 3, 2023:
    Sure, changed.

    instagibbs commented at 1:35 pm on August 3, 2023:

    didn’t realize preciousblock also reconsidered the block!

    was thinking reconsiderblock

  16. in test/functional/p2p_orphan_handling.py:269 in 29ec234654 outdated
    288+        # This UTXO is unconfirmed and in the mempool.
    289+        assert_equal(len(node.getrawmempool()), 0)
    290+        mempool_tx = self.wallet.send_self_transfer(from_node=node)
    291+        utxo_unconf_mempool = mempool_tx["new_utxo"]
    292+
    293+        # This UTXO is unconfirmed and missing.
    


    instagibbs commented at 6:02 pm on August 2, 2023:
    took me a second, just assert it’s not in mempool for those quickly reading

    glozow commented at 8:41 am on August 3, 2023:
    added
  17. in test/functional/p2p_orphan_handling.py:109 in 29ec234654 outdated
    104+                return False
    105+            return len(last_getdata.inv) == len(txids) and all([item.type == MSG_WITNESS_TX and item.hash in txids for item in last_getdata.inv])
    106+        self.wait_until(test_function, timeout=10)
    107+
    108+    def assert_message_ignored(self, message):
    109+        """Check that the node does not respond to this message with any of
    


    instagibbs commented at 6:06 pm on August 2, 2023:
    0        """Check that the node does not immediately respond to this message with any of
    

    glozow commented at 8:26 am on August 3, 2023:
    Done, and renamed to assert_no_immediate_response
  18. in test/functional/p2p_orphan_handling.py:180 in 29ec234654 outdated
    175+        # transaction entered its mempool.
    176+        node.sendrawtransaction(tx_real["hex"])
    177+        # Spy peer should not be able to query the node for the parent yet, since it hasn't been
    178+        # announced / insufficient time has elapsed.
    179+        parent_inv = CInv(t=MSG_WTX, h=int(tx_real["tx"].getwtxid(), 16))
    180+        peer_spy.assert_message_ignored(msg_getdata([parent_inv]))
    


    instagibbs commented at 6:06 pm on August 2, 2023:
    can we assert that peer_spy hasn’t received the INV, just to be sure?

    glozow commented at 8:28 am on August 3, 2023:
    added
  19. in test/functional/p2p_orphan_handling.py:191 in 29ec234654 outdated
    186+        # Request is scheduled with this delay because it is by txid and this
    187+        # not a preferred relay peer.
    188+        self.fastforward(TXID_RELAY_DELAY)
    189+        peer_spy.sync_with_ping()
    190+
    191+        self.log.info("Test parent requests don't reveal whether the parent was present when the orphan arrived")
    


    instagibbs commented at 6:08 pm on August 2, 2023:
    I don’t get this case. Why wouldn’t you request a “fake” parent if you don’t know it’s fake already?

    glozow commented at 8:39 am on August 3, 2023:

    Edited the comments.

    Without delays and filtering right before sending, I figured you could query whether tx_real has arrived in the node’s mempool yet by sending a fake orphan that spends from it (if the node requests tx_real they don’t have it yet, if they don’t request it then it’s already in mempool/seen). Hence “reveal.” But you can only know whether tx_real arrived in the last ~2-4 seconds.

  20. in test/functional/p2p_orphan_handling.py:326 in 29ec234654 outdated
    321+
    322+        self.log.info("Test handling of multiple orphans with missing parents that are already being requested")
    323+        # Parent of child_A only
    324+        missing_parent_A = self.wallet_nonsegwit.create_self_transfer()
    325+        # Parents of child_A and child_B
    326+        missing_parent_AB = self.wallet_nonsegwit.create_self_transfer()
    


    instagibbs commented at 6:09 pm on August 2, 2023:
    does this wallet never use 0-conf change? would be nice to assert to make it clear the lack of utxo connection

    glozow commented at 9:32 am on August 3, 2023:
    changed so we grab the utxos before making any transactions, so they all have to be confirmed and not related
  21. in test/functional/p2p_orphan_handling.py:331 in 29ec234654 outdated
    346+        self.log.info("The node should not request a parent if it has an in-flight txrequest")
    347+        # Relay orphan child_A
    348+        self.relay_transaction(peer_orphans, child_A["tx"])
    349+        self.fastforward(NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY)
    350+        # Both missing parents should be requested.
    351+        peer_orphans.wait_for_parent_requests([int(missing_parent_A["txid"], 16), int(missing_parent_AB["txid"], 16)])
    


    instagibbs commented at 6:17 pm on August 2, 2023:
    “The node should not request a parent if it has an in-flight txrequest” ? Seems like parents are being reqiested. Maybe a typo or I can’t tell what scenario it’s covering.

    glozow commented at 8:44 am on August 3, 2023:
    It should not request inflight_parent_AB even though it’s one of the missing parents. I’ll add a comment to explain this.

    instagibbs commented at 1:34 pm on August 3, 2023:
    much clearer, thanks
  22. in test/functional/p2p_orphan_handling.py:376 in 29ec234654 outdated
    386+        node = self.nodes[0]
    387+        peer1 = node.add_p2p_connection(PeerTxRelayer())
    388+        peer2 = node.add_p2p_connection(PeerTxRelayer())
    389+        peer3 = node.add_p2p_connection(PeerTxRelayer())
    390+
    391+        self.log.info("Test orphan handling when nonsegwit parent paid 0 fee")
    


    instagibbs commented at 6:23 pm on August 2, 2023:
    bit of a repeat with test_orphan_rejected_parents_exceptions ?

    glozow commented at 8:47 am on August 3, 2023:
    True this could be combined. The main idea for this test is that this transaction’s failure propagates all the way to the grandchild.

    glozow commented at 2:17 pm on August 3, 2023:
    (I didn’t change it but I also don’t feel strongly, could combine if you want)

    instagibbs commented at 2:17 pm on August 3, 2023:
    nope it’s fine
  23. instagibbs commented at 6:24 pm on August 2, 2023: member
    moar coverage good
  24. glozow force-pushed on Aug 3, 2023
  25. in test/functional/p2p_orphan_handling.py:155 in abe8536192 outdated
    156+        peer_spy.assert_no_immediate_response(msg_tx(tx_fake_orphan["tx"]))
    157+
    158+        # Node receives transaction. It attempts to obfuscate the exact timing at which this
    159+        # transaction entered its mempool. Send unsolicited because otherwise we need to wait for
    160+        # request delays.
    161+        peer_normal.send_and_ping(msg_tx(tx_parent_arrives["tx"]))
    


    instagibbs commented at 1:53 pm on August 3, 2023:
    0        peer_normal.send_and_ping(msg_tx(tx_parent_arrives["tx"]))
    1        assert tx_parent_arrives["txid"] in node.getrawmempool()
    

    my brain for some reason was thinking it was in the orphan pool as well


    ajtowns commented at 1:34 am on August 11, 2023:
    Should we add an rpc to allow querying the orphanage?

    glozow commented at 9:54 am on August 11, 2023:

    Should we add an rpc to allow querying the orphanage?

    Could do that, as there’s a bit of black box-ness here. Though I also think that the ideal situation would be to write unit tests if we’re interested in the exact contents of the orphanage.

  26. in test/functional/p2p_orphan_handling.py:136 in abe8536192 outdated
    139+    def test_arrival_timing_orphan(self):
    140+        self.log.info("Test missing parents that arrive during delay are not requested")
    141+        node = self.nodes[0]
    142+        tx_parent_arrives = self.wallet.create_self_transfer()
    143+        tx_parent_doesnt_arrive = self.wallet.create_self_transfer()
    144+        # Fake orphan spends nonexistent outputs of the two parents
    


    instagibbs commented at 1:57 pm on August 3, 2023:
    Ok I feel like I understand the test, but I still don’t know why it’s important the orphan is fake so I’m likely missing something

    glozow commented at 2:15 pm on August 3, 2023:
    It’s not that important :shrug: it can be a real child. I wrote the test trying to illustrate a spy peer trying to get information, i.e. one that doesn’t have the ability to spend the transaction’s UTXOs.

    instagibbs commented at 2:38 pm on August 8, 2023:
    Could you say that in the test then? This really throws me off as a reader!

    glozow commented at 3:13 pm on August 11, 2023:
    Sorree! Added explanation in the comment.
  27. Empact commented at 9:40 pm on August 3, 2023: member
    Concept ACK
  28. instagibbs commented at 2:39 pm on August 8, 2023: member
  29. glozow commented at 2:59 pm on August 8, 2023: member
    thanks for the concept acks @dergoegge @jamesob @brunoerg @Empact @jonatack, would appreciate a review of test too :pray:
  30. dergoegge approved
  31. dergoegge commented at 9:45 am on August 10, 2023: member
    Code review ACK abe8536192c9f2cd6ba9d0e083f23dec4d20841f
  32. in test/functional/p2p_orphan_handling.py:184 in abe8536192 outdated
    179+    def test_orphan_rejected_parents_exceptions(self):
    180+        node = self.nodes[0]
    181+        peer1 = node.add_p2p_connection(PeerTxRelayer())
    182+        peer2 = node.add_p2p_connection(PeerTxRelayer())
    183+
    184+        self.log.info("Test orphan handling when nonsegwit parent paid 0 fee")
    


    ajtowns commented at 1:46 am on August 11, 2023:

    Might be better to be clearer about the different behaviours you’re testing for, rather than how you’re triggering those behaviours? eg:

    • Orphan handling when parent is known to be invalid
    • Orphan handling when segwit parent may be retried with alternate witness data

    glozow commented at 3:13 pm on August 11, 2023:
    Agree, updated the logging
  33. in test/functional/p2p_orphan_handling.py:124 in abe8536192 outdated
    119+        """Create package with 1 parent and 1 child, normal fees (no cpfp)."""
    120+        parent = self.wallet.create_self_transfer()
    121+        child = self.wallet.create_self_transfer(utxo_to_spend=parent['new_utxo'])
    122+        return child["tx"].getwtxid(), child["tx"], parent["tx"]
    123+
    124+    def fastforward(self, seconds):
    


    ajtowns commented at 1:49 am on August 11, 2023:
    Maybe name this something that’s a bit more clearly related to mocktime (bumpmocktime?) and add it to BitcoinTestFramework ?

    glozow commented at 3:13 pm on August 11, 2023:
    Good point, added a bumpmocktime to test framework, I’ll probably use it in other tests in the future.
  34. ajtowns commented at 1:53 am on August 11, 2023: contributor

    ACK

    I think we should probably prefer to test behaviours that are intentional/desirable, rather than behaviours that just happen to be how it got implemented. It’s not immediately clear to me which class the things being tested here fall into.

  35. bitcoin deleted a comment on Aug 11, 2023
  36. glozow commented at 9:56 am on August 11, 2023: member

    I think we should probably prefer to test behaviours that are intentional/desirable, rather than behaviours that just happen to be how it got implemented.

    Yeah the purpose of writing these tests was largely documentation and not changing behavior unintentionally.

    I think most of the things here are intentional, though can think of at least one thing that seems to be “that’s just how it got implemented.” I was trying to figure out whether we would want to use a notfound for a parent tx to mean we should give up on processing the orphan that depends on it. Currently we don’t do anything since we don’t track the fact that the request is related to an orphan. But since we just request based on !AlreadyHaveTx we might reject due to a long-confirmed parent. I suppose it would be different if validation told net_processing which inputs were missing and request those. Though that doesn’t seem worth implementing if we can just do ancestor package relay.

  37. glozow force-pushed on Aug 11, 2023
  38. in test/functional/test_framework/test_framework.py:110 in afbc2b17e5 outdated
    102@@ -103,6 +103,11 @@ def __init__(self) -> None:
    103         self.supports_cli = True
    104         self.bind_to_localhost_only = True
    105         self.parse_args()
    106+        # Note that we haven't called setmocktime on any nodes yet. If a test wants to use
    107+        # setmocktime, it should call bumpmocktime(0) at the beginning of run_test in order to
    108+        # prevent spurious failures. If the test does not want to use setmocktime, it must not call
    109+        # setmocktime because the time will not move forward afterwards.
    110+        self.mocktime = int(time.time())
    


    dergoegge commented at 3:34 pm on August 11, 2023:

    Wouldn’t it make more sense to have bumpmocktime on TestNode and set self.mocktime when ever setmocktime is called?

    • allows for node independent mocktime bumping
    • allows to use an initial mocktime other than time.time()

    glozow commented at 8:12 am on August 14, 2023:
    Good point, moved from TestFramework to TestNode

    dergoegge commented at 12:55 pm on August 14, 2023:
    … and set self.mocktime when ever setmocktime is called?

    glozow commented at 1:45 pm on August 14, 2023:
    Added a wrapper for the RPC to update TestNode::mocktime every time setmocktime is called.
  39. glozow force-pushed on Aug 14, 2023
  40. glozow force-pushed on Aug 14, 2023
  41. in test/functional/test_framework/test_node.py:150 in 878f066565 outdated
    143@@ -144,6 +144,11 @@ def __init__(self, i, datadir, *, chain, rpchost, timewait, timeout_factor, bitc
    144         self.p2ps = []
    145         self.timeout_factor = timeout_factor
    146 
    147+        # The time doesn't move forwards after we mock it, so don't call setmocktime if the test
    148+        # doesn't intend to use it.  If a test wants to use setmocktime, it should call
    149+        # bumpmocktime(0) at the beginning of run_test in order to prevent spurious failures.
    150+        self.mocktime = int(time.time())
    


    dergoegge commented at 2:47 pm on August 14, 2023:

    Sorry for being nitty about this but it’s a little weird to have this set to some time that is different from the actual mock time of the node.

    I would suggest initializing this to None, resetting it to None if setmocktime(0) was called and additionally assert that it is not None in bumpmocktime.

    This ensures it is not set to some differing value (different from the actual mocktime) and makes sure bumpmocktime is used correctly. TestNode.mocktime can then also be reliably used as a getter for the node’s mocktime.


    glozow commented at 2:56 pm on August 14, 2023:
    Done. I like that the assertion forces tests to make an initial setmocktime call before calling bumpmocktime.
  42. [test framework] make it easier to fast-forward setmocktime
    Have each TestNode keep track of the last timestamp it called
    setmocktime with, and add a bumpmocktime() function to bump by a
    number of seconds. Makes it easy to fast forward n seconds without
    keeping track of what the last timestamp was.
    61e77bb901
  43. [functional test] transaction orphan handling 9eac5a0529
  44. glozow force-pushed on Aug 14, 2023
  45. dergoegge approved
  46. dergoegge commented at 3:27 pm on August 14, 2023: member
    reACK 9eac5a0529f869075f0331e40d322c34fc8fc2af
  47. DrahtBot requested review from instagibbs on Aug 14, 2023
  48. fanquake requested review from ajtowns on Aug 14, 2023
  49. in test/functional/p2p_orphan_handling.py:281 in 9eac5a0529
    276+
    277+        self.relay_transaction(peer, orphan["tx"])
    278+        self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY)
    279+        peer.sync_with_ping()
    280+        assert_equal(len(peer.last_message["getdata"].inv), 2)
    281+        peer.wait_for_parent_requests([int(txid_conf_old, 16), int(missing_tx["txid"], 16)])
    


    achow101 commented at 1:35 pm on August 15, 2023:
    Requesting the already confirmed transaction is surprising to me. Is this expected to change in future work (if so a comment mentioning that would be useful) or is it intended behavior?

    glozow commented at 1:42 pm on August 15, 2023:

    Requesting the already confirmed transaction is surprising to me.

    Yep, was strange to me too, but AlreadyHaveTx is peerman’s best metric for determining what the missing parents are (validation doesn’t say which one(s) are missing). Also afaiu it’s considered uncommon to (1) have an orphan (2) have a transaction that spends a very old coin, so I’m guessing this is quite rare.

    Is this expected to change in future work

    I’m not aware of any plans to change the legacy way of requesting orphan parents. But with package relay we’d ask for the list of unconfirmed ancestors, so we wouldn’t have this kind of false positive.

  50. in test/functional/p2p_orphan_handling.py:380 in 9eac5a0529
    375+        grandchild = self.wallet.create_self_transfer(utxo_to_spend=child["new_utxo"])
    376+        assert child["txid"] != child["tx"].getwtxid()
    377+        assert grandchild["txid"] != grandchild["tx"].getwtxid()
    378+
    379+        # Relay the parent. It should be rejected because it pays 0 fees.
    380+        self.relay_transaction(peer1, parent_low_fee_nonsegwit["tx"])
    


    achow101 commented at 1:36 pm on August 15, 2023:
    Could check that parent_low_fee_nonsegwit is not in the mempool as done in the other test cases.
  51. achow101 commented at 1:38 pm on August 15, 2023: member
    ACK 9eac5a0529f869075f0331e40d322c34fc8fc2af
  52. in test/functional/p2p_orphan_handling.py:116 in 9eac5a0529
    111+class OrphanHandlingTest(BitcoinTestFramework):
    112+    def set_test_params(self):
    113+        self.num_nodes = 1
    114+        self.extra_args = [[]]
    115+
    116+    def create_parent_and_child(self):
    


    fjahr commented at 3:27 pm on August 18, 2023:
    This function seems unused.

    glozow commented at 2:06 pm on August 22, 2023:

    My bad!

    I can also open a follow-up myself if someone feels like merging this as is.

    If it helps, they were written to be used in #28031. I pulled these tests out to merge before the refactors and I guess forgot to remove the helpers that aren’t used (yet).

  53. in test/functional/p2p_orphan_handling.py:66 in 9eac5a0529
    61+        super().__init__()
    62+        self._tx_received = []
    63+        self._getdata_received = []
    64+
    65+    @property
    66+    def tx_received(self):
    


    fjahr commented at 3:28 pm on August 18, 2023:
    This seems unused.
  54. in test/functional/p2p_orphan_handling.py:359 in 9eac5a0529
    354+        self.relay_transaction(peer, missing_parent_orphan["tx"])
    355+        self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY)
    356+        peer.wait_for_parent_requests([int(missing_grandparent["txid"], 16)])
    357+
    358+        # The node should put the orphan into the orphanage and request missing_parent, skipping
    359+        # missing_parent_orphan because it already has it in the orphanage.
    


    fjahr commented at 4:03 pm on August 18, 2023:
    Could add another assertion here that missing_parent_orphan is indeed only requested once.
  55. in test/functional/p2p_orphan_handling.py:301 in 9eac5a0529
    296+        # Sends the orphans
    297+        peer_orphans = node.add_p2p_connection(PeerTxRelayer())
    298+
    299+        confirmed_utxos = [self.wallet_nonsegwit.get_utxo() for _ in range(4)]
    300+        assert all([utxo["confirmations"] > 0 for utxo in confirmed_utxos])
    301+        self.log.info("Test handling of multiple orphans with missing parents that are already being requested")
    


    fjahr commented at 4:11 pm on August 18, 2023:
    nit: I would argue that the (or the first) log should always be the first line of the test. Otherwise it may be confusing if an error happens in the code above it may look like the previous test failed.
  56. in test/functional/p2p_orphan_handling.py:331 in 9eac5a0529
    326+        # Relay orphan child_A
    327+        self.relay_transaction(peer_orphans, child_A["tx"])
    328+        self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY)
    329+        # There are 3 missing parents. missing_parent_A and missing_parent_AB should be requested.
    330+        # But inflight_parent_AB should not, because there is already an in-flight request for it.
    331+        peer_orphans.wait_for_parent_requests([int(missing_parent_A["txid"], 16), int(missing_parent_AB["txid"], 16)])
    


    fjahr commented at 4:35 pm on August 18, 2023:
    nit: I was a bit irritated that that inflight_parent_AB not being requested isn’t checked here but I see it follows below. For expressiveness you could consider duplicating the check here or adding a small comment.
  57. in test/functional/p2p_orphan_handling.py:373 in 9eac5a0529
    368+        peer2 = node.add_p2p_connection(PeerTxRelayer())
    369+        peer3 = node.add_p2p_connection(PeerTxRelayer())
    370+
    371+        self.log.info("Test that an orphan with rejected parents, along with any descendants, cannot be retried with an alternate witness")
    372+        parent_low_fee_nonsegwit = self.wallet_nonsegwit.create_self_transfer(fee_rate=0)
    373+        assert_equal(parent_low_fee_nonsegwit["txid"], parent_low_fee_nonsegwit["tx"].getwtxid())
    


    fjahr commented at 4:42 pm on August 18, 2023:
    nit: This sanity check is repeated multiple times. I think it would be enough to do it once when setting up the MiniWallet since that seems to be the only way there could be an issue, if somehow MiniWallet is broken.
  58. fjahr commented at 4:50 pm on August 18, 2023: contributor

    Code review ACK 9eac5a0529f869075f0331e40d322c34fc8fc2af

    …modulo removing the dead code. Otherwise mostly nit-ish comments, I can also open a follow-up myself if someone feels like merging this as is.

  59. DrahtBot removed review request from instagibbs on Aug 22, 2023
  60. achow101 merged this on Aug 22, 2023
  61. achow101 closed this on Aug 22, 2023

  62. glozow deleted the branch on Aug 22, 2023

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: 2024-07-01 10:13 UTC

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