test: Remove -acceptnonstdtxn=1 from feature_rbf.py #25522

pull MarcoFalke wants to merge 5 commits into bitcoin:master from MarcoFalke:2207-test-rbf-acceptnonstdtxn-🐁 changing 2 files +202 −210
  1. MarcoFalke commented at 9:42 AM on July 1, 2022: member

    On the main network, nonstandard transactions are hardly relayed, so it seems odd that one of our policy test requires a policy setting opposite of the norm.

    Surely it is also important to test that nonstandard transactions can be replaced. However, rbf code should not care about the standardness at all. Moreover, I think testing nonstandardness rbf is of lower priority than testing the stuff that actually happens in production.

  2. fanquake added the label Tests on Jul 1, 2022
  3. fanquake requested review from theStack on Jul 1, 2022
  4. MarcoFalke force-pushed on Jul 1, 2022
  5. theStack commented at 10:17 AM on July 1, 2022: member

    Strong Concept ACK

  6. test: Allow absolute fee in MiniWallet create_self_transfer 2222842ae7
  7. test: Allow amount_per_output in MiniWallet create_self_transfer_multi fac3800d2c
  8. test: Allow setting sequence per input in MiniWallet create_self_transfer_multi
    Previously it was only possible to set the same sequence in all inputs
    fa29245827
  9. test: Make the scriptPubKey of MiniWallet created txs mutable
    This makes individual bytes of the scriptPubKey mutable, previously it
    could only be re-assigned as a whole.
    fa5059b7df
  10. MarcoFalke force-pushed on Jul 1, 2022
  11. DrahtBot commented at 11:48 PM on July 1, 2022: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #25461 (test: test RBF rule 3 by jamesob)
    • #25373 (Support ignoring "opt-in" flag for RBF (aka full RBF) by luke-jr)

    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.

  12. in test/functional/feature_rbf.py:116 in fa034ad54e outdated
     121 |  
     122 |          # Should fail because we haven't changed the fee
     123 | -        tx1b = deepcopy(tx_template)
     124 | -        tx1b.vout = [CTxOut(1 * COIN, DUMMY_2_P2WPKH_SCRIPT)]
     125 | -        tx1b_hex = tx1b.serialize().hex()
     126 | +        tx.vout[0].scriptPubKey[-1] -= 1
    


    theStack commented at 1:48 PM on July 3, 2022:

    This would fail if the scriptPubKey ends with a zero byte, e.g.:

    >>> spk = bytearray(b'\xbe\xef\x00')
    >>> spk[-1] -= 1
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: byte must be in range(0, 256)
    

    Modifying it with a bit-flip is probably slightly preffered:

    >>> spk[-1] ^= 1
    >>> spk
    bytearray(b'\xbe\xef\x01')
    
            tx.vout[0].scriptPubKey[-1] ^= 1
    

    MarcoFalke commented at 8:06 AM on July 4, 2022:

    Thx.

    The test should be deterministically pass even with -=1, but I've switched to ^=1 as it is cleaner.

  13. MarcoFalke force-pushed on Jul 4, 2022
  14. jamesob commented at 1:07 PM on July 4, 2022: member

    Concept ACK, will review early next week

  15. in test/functional/feature_rbf.py:246 in faf9f0005c outdated
     245 | -            dbl_tx.vout = [CTxOut(initial_nValue - 2 * fee * n, DUMMY_P2WPKH_SCRIPT)]
     246 | -            dbl_tx_hex = dbl_tx.serialize().hex()
     247 | +            dbl_tx_hex = self.wallet.create_self_transfer(
     248 | +                utxo_to_spend=tx0_outpoint,
     249 | +                sequence=0,
     250 | +                fee=2 * (Decimal(fee) / COIN) * n + Decimal("0.1"),
    


    theStack commented at 11:48 PM on July 5, 2022:

    Is the last part really needed?

                    fee=2 * (Decimal(fee) / COIN) * n,
    

    MarcoFalke commented at 8:22 AM on July 6, 2022:

    Good catch, fixed!

  16. theStack approved
  17. theStack commented at 11:54 PM on July 5, 2022: member

    Code-review ACK faf9f0005ca1ebcea461f66191efdc78af744660

    Very nice to see MiniWallet unfolding its full power! 🦾 the code is much more easier to reason about, without the need of manually crafting transactions. Unrelated to this PR, but I think the current mixture of different units for both absolute values/fees and fee-rates is a bit messy -- maybe we should aspire to only use sats and sats/vbyte at some point, which would get rid of many unneeded * COIN and / COIN operations.

  18. test: Remove -acceptnonstdtxn=1 from feature_rbf.py fad690ba0a
  19. MarcoFalke force-pushed on Jul 6, 2022
  20. theStack approved
  21. theStack commented at 9:31 AM on July 6, 2022: member

    re-ACK fad690ba0a62dfd97ef22711b2344909fcd1fb73

    The current CI failures seem to be unrelated to this PR.

  22. MarcoFalke commented at 6:24 PM on July 6, 2022: member

    (ci rerun after outage, now green)

  23. in test/functional/test_framework/wallet.py:235 in fac3800d2c outdated
     231 | @@ -232,12 +232,14 @@ def create_self_transfer_multi(
     232 |          *,
     233 |          utxos_to_spend: Optional[List[dict]] = None,
     234 |          num_outputs=1,
     235 | +        amount_per_output=0,
    


    jamesob commented at 7:56 PM on July 6, 2022:
  24. jamesob approved
  25. jamesob commented at 2:07 PM on July 7, 2022: member

    ACK fad690ba0a62dfd97ef22711b2344909fcd1fb73 (jamesob/ackr/25522.1.MarcoFalke.test_remove_acceptnonstd)

    Good change - significantly simplifies the RBF tests and allows us to avoid uncharacteristic use of nonstandard transactions.

  26. MarcoFalke merged this on Jul 7, 2022
  27. MarcoFalke closed this on Jul 7, 2022

  28. MarcoFalke deleted the branch on Jul 7, 2022
  29. MarcoFalke referenced this in commit 327b7e9236 on Jul 11, 2022
  30. sidhujag referenced this in commit 75c0a7f632 on Jul 11, 2022
  31. sidhujag referenced this in commit 7a88fde8df on Jul 11, 2022
  32. DrahtBot locked this on Jul 7, 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: 2026-04-14 21:13 UTC

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