Add bitcoin-tx JSON tests #8829
pull jnewbery wants to merge 1 commits into bitcoin:master from jnewbery:test-bitcoin-tx-json changing 12 files +997 −1-
jnewbery commented at 5:39 pm on September 28, 2016: member
-
Add bitcoin-tx JSON tests 54e5d7c1b8
-
MarcoFalke added the label Tests on Sep 28, 2016
-
laanwj commented at 6:16 am on September 29, 2016: member
-
MarcoFalke commented at 8:43 am on September 29, 2016: memberutACK 54e5d7c1b81e1b76f5789abfa2cb1f5963cd9d72
-
MarcoFalke merged this on Sep 29, 2016
-
MarcoFalke closed this on Sep 29, 2016
-
MarcoFalke referenced this in commit 8ca69a2a88 on Sep 29, 2016
-
MarcoFalke added the label Needs backport on Sep 29, 2016
-
MarcoFalke added this to the milestone 0.13.1 on Sep 29, 2016
-
paveljanik commented at 9:00 am on September 29, 2016: contributor
ups, merged in the middle of my testing :-)
postmerge ACK https://github.com/bitcoin/bitcoin/commit/54e5d7c1b81e1b76f5789abfa2cb1f5963cd9d72
-
droark commented at 11:32 am on September 29, 2016: contributorQuestion: Was txcreate2.json supposed to be empty? I’m assuming some test data was supposed to be in it. :)
-
jnewbery commented at 12:35 pm on September 29, 2016: member
Interesting. The txcreate2 test is attempting to create a transaction with a single pay-to-script output for zero satoshi. When outputting as json, bitcoin-tx returns the empty string. When outputting as hex, it returns 01000000000100000000000000000000000000, ie:
0version |number in|number out|out1 amount |out1 script length|nlocktime 101000000 00 01 0000000000000000 00 00000000
I think that’s garbage and bitcoin-tx should reject any attempt to add an output with zero satoshi. I’ll open a PR to fix that.
Interestingly, bitcoin-tx does output a json object if I try to create a zero-value transaction output to a non-empty script:
0$ bitcoin-tx -json -create outscript=0:"OP_DROP" 1{ 2 "txid": "f0851b68202f736b792649cfc960259c2374badcb644ab20cac726b5f72f61c9", 3 "version": 1, 4 "locktime": 0, 5 "vin": [ 6 ], 7 "vout": [ 8 { 9 "value": 0.00, 10 "n": 0, 11 "scriptPubKey": { 12 "asm": "OP_DROP", 13 "hex": "75", 14 "type": "nonstandard" 15 } 16 } 17 ], 18 "hex": "0100000000010000000000000000017500000000" 19}
txcreate2 is also the only test case that tests creating a pay-to-script, so we should add a new test case that tests adding a valid pay-to-script output.
-
jnewbery deleted the branch on Sep 29, 2016
-
sipa commented at 12:39 pm on September 29, 2016: memberZero-value outputs are perfectly valid according to consensus rules.
-
jnewbery commented at 12:45 pm on September 29, 2016: memberah, ok. Thanks. Then the fix is in bitcoin-tx to properly output zero-value, empty-script outputs.
-
laanwj commented at 12:48 pm on September 29, 2016: memberGood to see that we’re finding bugs in bitcoin-tx by adding tests :)
-
jnewbery commented at 1:02 pm on September 29, 2016: memberI’ve mischaracterised the problem here. bitcoin-tx is outputting the transaction correctly in hex and json. However, when I try to pipe that same hex transaction back into bitcoin-tx, it fails with
error: invalid transaction encoding
. -
sipa commented at 1:09 pm on September 29, 2016: memberAh, that seems to be due to the segwit ambiguity for 0-input transactions. IIRC, DecodeTransaction in core_io.h has a boolean parameter for attempting to decode partial transactions. It should be set to true in calls from bitcoin-tx.
-
jnewbery commented at 2:29 pm on September 29, 2016: member
-
MarcoFalke referenced this in commit 2a8bca465d on Oct 3, 2016
-
MarcoFalke removed the label Needs backport on Oct 13, 2016
-
codablock referenced this in commit 1eba1e1962 on Sep 19, 2017
-
codablock referenced this in commit 963f6a6f3a on Jan 12, 2018
-
lateminer referenced this in commit c7f6a2e815 on Nov 10, 2018
-
andvgal referenced this in commit c13d3c3fa1 on Jan 6, 2019
-
zkbot referenced this in commit 44f5ef7c9d on Nov 9, 2020
-
zkbot referenced this in commit bd5ff7c889 on Nov 9, 2020
-
DrahtBot locked this on Sep 8, 2021
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 18:12 UTC
More mirrored repositories can be found on mirror.b10c.me