test: test decodepsbt fee calculation (count input value only once per UTXO) #19597

pull theStack wants to merge 1 commits into bitcoin:master from theStack:20200726-test-check-deceodepsbt-fee-calculation changing 1 files +4 −2
  1. theStack commented at 11:22 AM on July 27, 2020: member

    Fixes #19523, adding a simple test to rpc_psbt.py that checks that the decodepsbt fee matches the one given by the wallet (walletcreatefundedpsbt). This is in particular important for PSBTs with segwit inputs that have both a witness- and a non-witness-UTXO type set.

    Example test run after reverting commit 75122780e2c46505d977e24c5612dfa9442ab754 ("Increment input value sum only once per UTXO in decodepsbt"):

    $ test/functional/rpc_psbt.py
    2020-07-26T11:31:44.862000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test__sutcd4y
    20.00007580
    2020-07-26T11:31:47.073000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "/home/honeybadger/buidl/bitcoin_thestack/test/functional/test_framework/test_framework.py", line 118, in main
        self.run_test()
      File "test/functional/rpc_psbt.py", line 166, in run_test
        assert_equal(decoded['fee'], created_psbt['fee'])
      File "/home/honeybadger/buidl/bitcoin_thestack/test/functional/test_framework/util.py", line 49, in assert_equal
        raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
    AssertionError: not(20.00007580 == 0.00007580)
    2020-07-26T11:31:47.125000Z TestFramework (INFO): Stopping nodes
    ......
    
  2. test: test decodepsbt fee calculation (count input value only once per UTXO)
    Checks that the RPC decodepsbt calculates the fee correctly, in particular for
    PSBTs with segwit inputs that have both a witness- and a non-witness-UTXO type
    set. Before commit 75122780e2c46505d977e24c5612dfa9442ab754 ("Increment input
    value sum only once per UTXO in decodepsbt") the values for those inputs were
    double counted.
    82dee87933
  3. fanquake added the label Tests on Jul 27, 2020
  4. achow101 commented at 4:57 PM on July 27, 2020: member

    ACK 82dee87933ed0714976ff4eb9657acfc13c6de84

  5. MarcoFalke merged this on Jul 30, 2020
  6. MarcoFalke closed this on Jul 30, 2020

  7. sidhujag referenced this in commit 7fcb89f864 on Jul 31, 2020
  8. theStack deleted the branch on Dec 1, 2020
  9. DrahtBot locked this on Feb 15, 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: 2026-04-13 21:14 UTC

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