test: Properly deserialize witness transactions in wallet_basic test #17773

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:1912-testWalletVsizeWitness changing 1 files +1 −1
  1. MarcoFalke commented at 10:21 pm on December 18, 2019: member

    Wallet transactions have inputs, thus they are witness transactions. So properly set iswitness to true.

    This fixes the errors of the following kind:

     0 test  2019-12-18T14:46:14.457000Z TestFramework (ERROR): Assertion failed 
     1                                   Traceback (most recent call last):
     2                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 112, in main
     3                                       self.run_test()
     4                                     File "/bitcoin/test/functional/wallet_basic.py", line 207, in run_test
     5                                       node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('20'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
     6                                     File "/bitcoin/test/functional/wallet_basic.py", line 48, in check_fee_amount
     7                                       assert_fee_amount(fee, tx_size, fee_per_byte * 1000)
     8                                     File "/bitcoin/test/functional/test_framework/util.py", line 39, in assert_fee_amount
     9                                       raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)" % (str(fee), str(target_fee)))
    10                                   AssertionError: Fee of 0.00011000 BTC too low! (Should be 0.00019100 BTC)
    

    Full log (with color):

    log.colored.txt

    Relevant excerpt:

    0 node2 2019-12-18T14:46:13.427834Z [httpworker.0] [default wallet] Fee Calculation: Fee:11000 Bytes:110 Needed:11000 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) -nan% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) -nan% 0.0/(0.0 0 mem 0.0 out) 
    1 node2 2019-12-18T14:46:13.427867Z [httpworker.0] [default wallet] CommitTransaction: 
    2                                   CTransaction(hash=cc2d0a7862, ver=2, vin.size=1, vout.size=1, nLockTime=205)
    3                                       CTxIn(COutPoint(fe5a0c8830, 1), scriptSig=, nSequence=4294967294)
    4                                       CScriptWitness(30440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff01, 03a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2)
    5                                       CTxOut(nValue=9.99989000, scriptPubKey=001475dafea69b760d8e2024cf0bcd)
    6 node2 2019-12-18T14:46:13.427954Z [httpworker.0] [default wallet] AddToWallet cc2d0a786278c12034c0d286d1876bfaf10dd19253d8efecaa6621c81baa0030  new 
    

    Raw transaction:

     0# ./src/bitcoin-cli -datadir=/tmp/test_runner_\342\202\277_\360\237\217\203_20191218_144609/wallet_basic_126/node2/ gettransaction cc2d0a786278c12034c0d286d1876bfaf10dd19253d8efecaa6621c81baa0030
     1{
     2  "amount": -9.99989000,
     3  "fee": -0.00011000,
     4  "confirmations": 1,
     5  "blockhash": "16f12dd1747458d905ec81af9dc1d576e011f0e4bc426f1b4559e77dd9d922df",
     6  "blockheight": 206,
     7  "blockindex": 1,
     8  "blocktime": 1576680407,
     9  "txid": "cc2d0a786278c12034c0d286d1876bfaf10dd19253d8efecaa6621c81baa0030",
    10  "walletconflicts": [
    11  ],
    12  "time": 1576680373,
    13  "timereceived": 1576680373,
    14  "bip125-replaceable": "no",
    15  "details": [
    16    {
    17      "address": "bcrt1qwhd0af5mwcxcugpyeu9umng4zewfwug47fhhe7",
    18      "category": "send",
    19      "amount": -9.99989000,
    20      "vout": 0,
    21      "fee": -0.00011000,
    22      "abandoned": false
    23    }
    24  ],
    25  "hex": "02000000000101dbada06e823a7eaca640c0248aaa7c145f790299acddfc49f6fdbf30880c5afe0100000000feffffff01089f9a3b0000000016001475dafea69b760d8e2024cf0bcdcd15165c977115024730440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff012103a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2cd000000"
    26}
    27
    28# ./src/bitcoin-cli -datadir=/tmp/test_runner_\342\202\277_\360\237\217\203_20191218_144609/wallet_basic_126/node2/ decoderawtransaction 02000000000101dbada06e823a7eaca640c0248aaa7c145f790299acddfc49f6fdbf30880c5afe0100000000feffffff01089f9a3b0000000016001475dafea69b760d8e2024cf0bcdcd15165c977115024730440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff012103a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2cd000000
    29{
    30  "txid": "658ee42c79f167c7ad21071773ca008d71e73cd42a36d6da0b66651b6d203a00",
    31  "hash": "658ee42c79f167c7ad21071773ca008d71e73cd42a36d6da0b66651b6d203a00",
    32  "version": 2,
    33  "size": 191,
    34  "vsize": 191,
    35  "weight": 764,
    36  "locktime": 205,
    37  "vin": [
    38  ],
    39  "vout": [
    40    {
    41      "value": 90957258090.81899777,
    42      "n": 0,
    43      "scriptPubKey": {
    44        "asm": "OP_RIPEMD160 c0248aaa7c145f790299acddfc49f6fdbf30880c5afe0100000000feffffff01089f9a3b0000000016001475dafea69b760d8e2024cf0bcdcd15165c97711502 30440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff01 03a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2",
    45        "hex": "a640c0248aaa7c145f790299acddfc49f6fdbf30880c5afe0100000000feffffff01089f9a3b0000000016001475dafea69b760d8e2024cf0bcdcd15165c977115024730440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff012103a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2",
    46        "type": "nonstandard"
    47      }
    48    }
    49  ]
    50}
    51
    52# ./src/bitcoin-cli -datadir=/tmp/test_runner_\342\202\277_\360\237\217\203_20191218_144609/wallet_basic_126/node2/ decoderawtransaction 02000000000101dbada06e823a7eaca640c0248aaa7c145f790299acddfc49f6fdbf30880c5afe0100000000feffffff01089f9a3b0000000016001475dafea69b760d8e2024cf0bcdcd15165c977115024730440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff012103a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2cd000000 | grep vsize
    53  "vsize": 191,
    54
    55
    56# ./src/bitcoin-cli -datadir=/tmp/test_runner_\342\202\277_\360\237\217\203_20191218_144609/wallet_basic_126/node2/ decoderawtransaction 02000000000101dbada06e823a7eaca640c0248aaa7c145f790299acddfc49f6fdbf30880c5afe0100000000feffffff01089f9a3b0000000016001475dafea69b760d8e2024cf0bcdcd15165c977115024730440220072d2f1dd001dc40aadec3c3926360033cc036250d603d957556562569d59958022000ca2f88a49c29075d534c1ed89ee678b6b4e9b5e28a897f37e3b5df6d114dff012103a7059f3416e80411ec1e02ecbf3e665fceda21d23a4e84e1559f2ed628da95c2cd000000 true | grep vsize
    57  "vsize": 110,
    
  2. test: Fix rare error in wallet_basic test for witness transactions fa4c6bf6be
  3. fanquake added the label Tests on Dec 18, 2019
  4. DrahtBot commented at 2:25 am on December 19, 2019: 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:

    • #17566 (Switch to weight units for all feerates computation by darosior)

    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.

  5. MarcoFalke renamed this:
    test: Fix rare error in wallet_basic test for witness transactions
    test: Properly deserialize witness transactions in wallet_basic test
    on Dec 19, 2019
  6. instagibbs commented at 3:35 pm on December 19, 2019: member
    @MarcoFalke How about #17775 instead?
  7. MarcoFalke closed this on Dec 19, 2019

  8. MarcoFalke deleted the branch on Dec 19, 2019
  9. laanwj referenced this in commit 3956165903 on Oct 15, 2020
  10. sidhujag referenced this in commit c5573afce9 on Oct 16, 2020
  11. DrahtBot locked this on Dec 16, 2021

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-11-17 09:12 UTC

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