Dump transaction version as an unsigned integer in RPC/TxToUniv #16525

pull TheBlueMatt wants to merge 2 commits into bitcoin:master from TheBlueMatt:2019-07-unsigned-tx-ver changing 4 files +18 −6
  1. TheBlueMatt commented at 10:05 PM on August 1, 2019: member

    Consensus-wise we already treat it as an unsigned integer (the only rules around it are in CSV/locktime handling), but changing the underlying data type means touching consensus code for a simple cleanup change, which isn't really worth it.

    See-also, https://github.com/rust-bitcoin/rust-bitcoin/pull/299

  2. fanquake added the label RPC/REST/ZMQ on Aug 1, 2019
  3. fanquake commented at 12:15 AM on August 2, 2019: member

    rpc_rawtransaction.py is failing with:

    test/functional/test_runner.py rpc_rawtransaction.py
    Temporary test directory at /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20190802_081411
    Remaining jobs: [rpc_rawtransaction.py]
    1/1 - rpc_rawtransaction.py failed, Duration: 28 s     
    
    stdout:
    2019-08-02T00:14:11.781000Z TestFramework (INFO): Initializing test directory /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20190802_081411/rpc_rawtransaction_0
    2019-08-02T00:14:13.145000Z TestFramework (INFO): prepare some coins for multiple *rawtransaction commands
    2019-08-02T00:14:20.763000Z TestFramework (INFO): Test getrawtransaction on genesis block coinbase returns an error
    2019-08-02T00:14:20.765000Z TestFramework (INFO): Check parameter types and required parameters of createrawtransaction
    2019-08-02T00:14:20.906000Z TestFramework (INFO): Check that createrawtransaction accepts an array and object as outputs
    2019-08-02T00:14:20.975000Z TestFramework (INFO): sendrawtransaction with missing prevtx info (bech32)
    2019-08-02T00:14:21.107000Z TestFramework (INFO): sendrawtransaction with missing prevtx info (p2sh-segwit)
    2019-08-02T00:14:21.228000Z TestFramework (INFO): sendrawtransaction with missing prevtx info (legacy)
    2019-08-02T00:14:21.294000Z TestFramework (INFO): sendrawtransaction with missing input
    2019-08-02T00:14:39.081000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "/Users/michael/github/bitcoin/test/functional/test_framework/test_framework.py", line 193, in main
        self.run_test()
      File "/Users/michael/github/bitcoin/test/functional/rpc_rawtransaction.py", line 424, in run_test
        assert_equal(decrawtx['version'], -0x80000000)
      File "/Users/michael/github/bitcoin/test/functional/test_framework/util.py", line 40, in assert_equal
        raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
    AssertionError: not(2147483648 == -2147483648)
    2019-08-02T00:14:39.135000Z TestFramework (INFO): Stopping nodes
    2019-08-02T00:14:39.499000Z TestFramework (WARNING): Not cleaning up dir /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20190802_081411/rpc_rawtransaction_0
    2019-08-02T00:14:39.499000Z TestFramework (ERROR): Test failed. Test logging available at /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20190802_081411/rpc_rawtransaction_0/test_framework.log
    2019-08-02T00:14:39.499000Z TestFramework (ERROR): Hint: Call /Users/michael/github/bitcoin/test/functional/combine_logs.py '/var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20190802_081411/rpc_rawtransaction_0' to consolidate all logs
    
    rpc_rawtransaction.py | ✖ Failed  | 28 s
    
  4. TheBlueMatt force-pushed on Aug 2, 2019
  5. MarcoFalke commented at 12:07 PM on August 2, 2019: member

    This needs to update the rpc help texts and add release notes

  6. TheBlueMatt commented at 3:13 PM on August 2, 2019: member

    Does it? Negative transaction versions are already non-standard so you can't materially use them.

  7. MarcoFalke commented at 3:31 PM on August 2, 2019: member

    Because they are non-standard doesn't mean they are not in the main chain. There are many databases or explorers out there that use the rpc interface to get tx info. See for example https://www.smartbit.com.au/tx/35e79ee733fad376e76d16d1f10088273c2f4c2eaba1374a837378a88e530005

    Changing the return type will break their deployment.

  8. practicalswift commented at 5:04 PM on August 2, 2019: contributor

    Concept ACK assuming @MarcoFalke's feedback is addressed

  9. Dump transaction version as an unsigned integer in RPC/TxToUniv
    Consensus-wise we already treat it as an unsigned integer (the
    only rules around it are in CSV/locktime handling), but changing
    the underlying data type means touching consensus code for a
    simple cleanup change, which isn't really worth it.
    
    See-also, https://github.com/rust-bitcoin/rust-bitcoin/pull/299
    970de70bdd
  10. TheBlueMatt force-pushed on Aug 2, 2019
  11. TheBlueMatt commented at 7:37 PM on August 2, 2019: member

    Added release notes.

  12. in doc/release-notes-16525.md:1 in 970de70bdd outdated
       0 | @@ -0,0 +1,7 @@
       1 | +RPC changes
    


    promag commented at 12:12 AM on August 7, 2019:

    nit, REST /rest/tx/txid.json is also affected.

  13. fanquake added the label Needs Conceptual Review on Aug 14, 2019
  14. fanquake added this to the "Chasing Concept ACK" column in a project

  15. ajtowns commented at 10:57 AM on August 15, 2019: member

    joinpsbts in rpc/rawtransaction.cpp looks to me like it'll currently leave nVersion as 1 rather than allowing a negative (or 2**31 or higher) value; nothing else seems like it has behaviour changes if nVersion were unsigned rather than signed.

    Concept ACK

  16. luke-jr commented at 9:26 PM on August 23, 2019: member

    Concept ACK. Can you rebase this onto 37f236acc6de08745118ac6cb4268bb5206e67c6 so it's a clean merge to 0.18 too?

  17. Additionally treat Tx.nVersion as unsigned in joinpsbts
    This gets its own release note callout, though doesn't appear to
    violate the BIP as the BIP appears to be underspecified. We
    probably want to update BIP 174 to mention how version numbers are
    combined.
    e80259f197
  18. TheBlueMatt commented at 2:55 PM on September 3, 2019: member

    @ajtowns I updated in a new commit to combine by treating nVersion as unsigned, which, as far as I can tell, doesn't violate BIP 174, though as I understand it it probably makes sense to have specified this kind of thing in the BIP.

  19. achow101 commented at 8:51 PM on September 3, 2019: member

    Concept ACK. The changes to joinpsbts look correct. As that RPC is part of the "creator" role, the version number to be used is up to the discretion of the creator so it isn't actually specified in the BIP.

  20. sipa commented at 6:21 AM on March 4, 2020: member

    ACK e80259f1976545e4f1ab6a420644be0c32261773

  21. practicalswift commented at 7:04 AM on March 4, 2020: contributor

    ACK e80259f1976545e4f1ab6a420644be0c32261773

  22. ajtowns commented at 5:29 AM on March 6, 2020: member

    ACK e80259f1976545e4f1ab6a420644be0c32261773 code review -- checked all other uses of tx.nVersion treat it as unsigned (except for policy.cpp:IsStandard anyway), so looks good.

  23. practicalswift commented at 5:49 AM on April 25, 2020: contributor

    Ready for merge? :)

  24. fanquake removed the label Needs Conceptual Review on Apr 25, 2020
  25. fanquake removed this from the "Chasing Concept ACK" column in a project

  26. naumenkogs commented at 9:43 PM on May 16, 2020: member

    ACK e80259f

  27. laanwj merged this on Jul 16, 2020
  28. laanwj closed this on Jul 16, 2020

  29. sidhujag referenced this in commit 0fcc1ca17e on Jul 18, 2020
  30. Fabcien referenced this in commit f6f043e01d on Sep 2, 2021
  31. 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 15:14 UTC

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