test: use MiniWallet for make_utxo helper in feature_rbf.py #22998

pull theStack wants to merge 3 commits into bitcoin:master from theStack:202109-test-use_miniwallet_for_make_utxo changing 2 files +39 −36
  1. theStack commented at 2:42 pm on September 16, 2021: member

    This PR aims to further increase MiniWallet usage in the functional test feature_rbf.py by using it in the make_utxo(...) helper, which is the only part that needs a wallet for most sub-tests. In order to do that, the amounts for the utxos have to be scaled down in two sub-tests first (test_doublespend_chain and test_doublespend_tree, see first two commits), since we need amounts passed to make_utxo than can be funded by only one input. For creating UTXOs with a value of 50 BTC, we’d need to implement a method for consolidating multiple utxos into one first, which seems to be overkill.

    Note that after this PR’s change, there is only one sub-test left (test_rpc) that needs the wallet compiled into bitcoind.

  2. test: scale amounts in test_doublespend_chain down by factor 10
    This is done in order to prepare the make_utxo helper to use MiniWallet,
    which only supports creating transactions with single inputs, i.e. we
    need to create amounts small enough to be funded by coinbase transactions
    (50 BTC).
    d1e2481274
  3. test: scale amounts in test_doublespend_tree down by factor 10
    This is done in order to prepare the make_utxo helper to use MiniWallet,
    which only supports creating transactions with single inputs, i.e. we
    need to create amounts small enough to be funded by coinbase transactions
    (50 BTC).
    0f27524602
  4. test: use MiniWallet for make_utxo helper in feature_rbf.py f680d27155
  5. theStack force-pushed on Sep 16, 2021
  6. DrahtBot added the label Tests on Sep 16, 2021
  7. DrahtBot commented at 4:20 pm on September 16, 2021: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #22867 (test: Extend test coverage of BIP125 and document confusing/inconsistent behavior by mjdietzx)
    • #22290 (Package Mempool Submission with Package Fee-Bumping by glozow)

    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.

  8. Shubhankar-Gambhir commented at 10:28 am on September 21, 2021: contributor

    concept ACK successfully ran test with

     02021-09-21T10:20:52.294000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_gvoms1s4
     12021-09-21T10:20:57.334000Z TestFramework (INFO): Running test simple doublespend...
     22021-09-21T10:20:57.352000Z TestFramework (INFO): Running test doublespend chain...
     32021-09-21T10:20:57.415000Z TestFramework (INFO): Running test doublespend tree...
     42021-09-21T10:20:57.877000Z TestFramework (INFO): Running test replacement feeperkb...
     52021-09-21T10:20:57.934000Z TestFramework (INFO): Running test spends of conflicting outputs...
     62021-09-21T10:20:57.945000Z TestFramework (INFO): Running test new unconfirmed inputs...
     72021-09-21T10:20:57.953000Z TestFramework (INFO): Running test too many replacements...
     82021-09-21T10:20:58.020000Z TestFramework (INFO): Running test opt-in...
     92021-09-21T10:20:58.034000Z TestFramework (INFO): Running test prioritised transactions...
    102021-09-21T10:20:58.114000Z TestFramework (INFO): Running test no inherited signaling...
    112021-09-21T10:20:58.121000Z TestFramework (INFO): Check that the child tx can still be replaced (via a tx that also replaces the parent)
    122021-09-21T10:20:58.124000Z TestFramework (INFO): Running test replacement relay fee...
    132021-09-21T10:20:58.126000Z TestFramework (INFO): Passed
    142021-09-21T10:20:58.177000Z TestFramework (INFO): Stopping nodes
    152021-09-21T10:20:58.581000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_gvoms1s4 on exit
    162021-09-21T10:20:58.582000Z TestFramework (INFO): Tests successful
    
     02021-09-21T10:18:35.765000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_q9cpp4nw
     12021-09-21T10:18:42.487000Z TestFramework (INFO): Running test simple doublespend...
     22021-09-21T10:18:42.504000Z TestFramework (INFO): Running test doublespend chain...
     32021-09-21T10:18:42.553000Z TestFramework (INFO): Running test doublespend tree...
     42021-09-21T10:18:43.002000Z TestFramework (INFO): Running test replacement feeperkb...
     52021-09-21T10:18:43.062000Z TestFramework (INFO): Running test spends of conflicting outputs...
     62021-09-21T10:18:43.073000Z TestFramework (INFO): Running test new unconfirmed inputs...
     72021-09-21T10:18:43.081000Z TestFramework (INFO): Running test too many replacements...
     82021-09-21T10:18:43.147000Z TestFramework (INFO): Running test opt-in...
     92021-09-21T10:18:43.159000Z TestFramework (INFO): Running test RPC...
    102021-09-21T10:18:43.728000Z TestFramework (INFO): Running test prioritised transactions...
    112021-09-21T10:18:43.817000Z TestFramework (INFO): Running test no inherited signaling...
    122021-09-21T10:18:43.823000Z TestFramework (INFO): Check that the child tx can still be replaced (via a tx that also replaces the parent)
    132021-09-21T10:18:43.825000Z TestFramework (INFO): Running test replacement relay fee...
    142021-09-21T10:18:43.828000Z TestFramework (INFO): Passed
    152021-09-21T10:18:43.878000Z TestFramework (INFO): Stopping nodes
    162021-09-21T10:18:47.246000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_q9cpp4nw on exit
    172021-09-21T10:18:47.246000Z TestFramework (INFO): Tests successful
    
  9. in test/functional/feature_rbf.py:113 in f680d27155
    127+        # nValue has to be adapted accordingly (amount and fee deduction). To keep things
    128+        # simple, we use a fixed fee of 1000 Satoshis here.
    129+        fee = 1000
    130+        tx = self.wallet.create_self_transfer(from_node=node, fee_rate=0, mempool_valid=False)['tx']
    131+        assert_greater_than(tx.vout[0].nValue, amount + fee)
    132+        tx.vout[0].nValue -= (amount + fee)           # change output -> MiniWallet
    


    MarcoFalke commented at 10:53 am on September 21, 2021:
    What happens if this output is removed? Previously the wallet would also “donate” the change to the fee.

    theStack commented at 11:37 am on September 21, 2021:
    IIUC what you mean: without this output, no new utxo to the internal MiniWallet scriptPubKey is created, i.e. we would probably run out of funds (or, could only create as many transactions as there are coinbase outputs from the pre-mined blocks from the test framework).
  10. MarcoFalke approved
  11. MarcoFalke commented at 10:54 am on September 21, 2021: member

    review ACK f680d27155374de658d40db0ba40460919aa1ba2 🦐

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3review ACK f680d27155374de658d40db0ba40460919aa1ba2 🦐
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUjbcgwAkRTDpqwf/UETFI6ocdBFK2PZqYgMFszvH/UuC2h2MvgeZGV8ZnBl8BKQ
     84wyWuZJSY13QCjVbaUeF0jqzMw8mJd1KUMaAw3nHP4lasGpuOxhhP5l0xyK6UJB1
     91inOWwb1GEB2p5Bhd6m0q4ucSo3da5OBdE1OO+GAmOBaEZE5AKvExIxnZEd74A1E
    10yL1K6vzw+ajJaofIOm/AkOe9x7mrHC4ilqOrQVf4UHZ3YG9np9BVDx4srCbyaXWr
    11OHeTY9EJx38XSLJooQs9Ap+7zexx8jXv6vqsJuR+deZoq83xqo4WaInrXsCFDiux
    12yFccruXkXlIh47BEkwSKRBI/7avqiNvNoVKiQGHhFbn2km9YIkEJRASfCuB5kxca
    13MM6xt6GfvSQc7IiUiN3DaACJH1ut5GALVX0KiJRw1Y+wYlWJjqwoG0TgJUezXaUy
    145+oP93maZNRsWses07raJXmJ8j2hSYcvPmfGeOKWDgDpEXJfk/r7b/MZFPBzOG8q
    15kqgKZP7P
    16=4DjW
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 8c9f3fb0e7a45d86ca12d77967ff62c2f410f3766b9ea0920fb291caba583a61 -

  12. MarcoFalke merged this on Sep 21, 2021
  13. MarcoFalke closed this on Sep 21, 2021

  14. theStack deleted the branch on Sep 21, 2021
  15. sidhujag referenced this in commit 3b040f6da7 on Sep 21, 2021
  16. MarcoFalke referenced this in commit 33e31f8df9 on Sep 29, 2021
  17. DrahtBot locked this on Oct 30, 2022

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-09-29 01:12 UTC

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