Skip to content

Commit 2a8bca4

Browse files
jnewberyMarcoFalke
authored andcommitted
Add bitcoin-tx JSON tests
Github-Pull: #8829 Rebased-From: 54e5d7c
1 parent 9bbe66e commit 2a8bca4

12 files changed

+997
-1
lines changed

src/test/data/bitcoin-util-test.json

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
[
2-
{ "exec": "././bitcoin-tx",
2+
{ "exec": "./bitcoin-tx",
33
"args": ["-create"],
44
"output_cmp": "blanktx.hex"
55
},
6+
{ "exec": "./bitcoin-tx",
7+
"args": ["-json","-create"],
8+
"output_cmp": "blanktx.json"
9+
},
610
{ "exec": "./bitcoin-tx",
711
"args": ["-"],
812
"input": "blanktx.hex",
913
"output_cmp": "blanktx.hex"
1014
},
15+
{ "exec": "./bitcoin-tx",
16+
"args": ["-json","-"],
17+
"input": "blanktx.hex",
18+
"output_cmp": "blanktx.json"
19+
},
1120
{ "exec": "./bitcoin-tx",
1221
"args": ["-", "delin=1"],
1322
"input": "tx394b54bb.hex",
1423
"output_cmp": "tt-delin1-out.hex"
1524
},
25+
{ "exec": "./bitcoin-tx",
26+
"args": ["-json", "-", "delin=1"],
27+
"input": "tx394b54bb.hex",
28+
"output_cmp": "tt-delin1-out.json"
29+
},
1630
{ "exec": "./bitcoin-tx",
1731
"args": ["-", "delin=31"],
1832
"input": "tx394b54bb.hex",
@@ -23,6 +37,11 @@
2337
"input": "tx394b54bb.hex",
2438
"output_cmp": "tt-delout1-out.hex"
2539
},
40+
{ "exec": "./bitcoin-tx",
41+
"args": ["-json", "-", "delout=1"],
42+
"input": "tx394b54bb.hex",
43+
"output_cmp": "tt-delout1-out.json"
44+
},
2645
{ "exec": "./bitcoin-tx",
2746
"args": ["-", "delout=2"],
2847
"input": "tx394b54bb.hex",
@@ -33,6 +52,11 @@
3352
"input": "tx394b54bb.hex",
3453
"output_cmp": "tt-locktime317000-out.hex"
3554
},
55+
{ "exec": "./bitcoin-tx",
56+
"args": ["-json", "-", "locktime=317000"],
57+
"input": "tx394b54bb.hex",
58+
"output_cmp": "tt-locktime317000-out.json"
59+
},
3660
{ "exec": "./bitcoin-tx",
3761
"args":
3862
["-create",
@@ -43,10 +67,25 @@
4367
"outaddr=4:1P8yWvZW8jVihP1bzHeqfE4aoXNX8AVa46"],
4468
"output_cmp": "txcreate1.hex"
4569
},
70+
{ "exec": "./bitcoin-tx",
71+
"args":
72+
["-json",
73+
"-create",
74+
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
75+
"in=bf829c6bcf84579331337659d31f89dfd138f7f7785802d5501c92333145ca7c:18",
76+
"in=22a6f904655d53ae2ff70e701a0bbd90aa3975c0f40bfc6cc996a9049e31cdfc:1",
77+
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
78+
"outaddr=4:1P8yWvZW8jVihP1bzHeqfE4aoXNX8AVa46"],
79+
"output_cmp": "txcreate1.json"
80+
},
4681
{ "exec": "./bitcoin-tx",
4782
"args": ["-create", "outscript=0:"],
4883
"output_cmp": "txcreate2.hex"
4984
},
85+
{ "exec": "./bitcoin-tx",
86+
"args": ["-json", "-create", "outscript=0:"],
87+
"output_cmp": "txcreate2.json"
88+
},
5089
{ "exec": "./bitcoin-tx",
5190
"args":
5291
["-create",
@@ -57,6 +96,17 @@
5796
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
5897
"output_cmp": "txcreatesign.hex"
5998
},
99+
{ "exec": "./bitcoin-tx",
100+
"args":
101+
["-json",
102+
"-create",
103+
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
104+
"set=privatekeys:[\"5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf\"]",
105+
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
106+
"sign=ALL",
107+
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
108+
"output_cmp": "txcreatesign.json"
109+
},
60110
{ "exec": "./bitcoin-tx",
61111
"args":
62112
["-create",
@@ -79,6 +129,15 @@
79129
"outdata=4:54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
80130
"output_cmp": "txcreatedata1.hex"
81131
},
132+
{ "exec": "./bitcoin-tx",
133+
"args":
134+
["-json",
135+
"-create",
136+
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
137+
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
138+
"outdata=4:54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
139+
"output_cmp": "txcreatedata1.json"
140+
},
82141
{ "exec": "./bitcoin-tx",
83142
"args":
84143
["-create",
@@ -87,17 +146,41 @@
87146
"outdata=54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
88147
"output_cmp": "txcreatedata2.hex"
89148
},
149+
{ "exec": "./bitcoin-tx",
150+
"args":
151+
["-json",
152+
"-create",
153+
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
154+
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
155+
"outdata=54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
156+
"output_cmp": "txcreatedata2.json"
157+
},
90158
{ "exec": "./bitcoin-tx",
91159
"args":
92160
["-create",
93161
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967293",
94162
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o"],
95163
"output_cmp": "txcreatedata_seq0.hex"
96164
},
165+
{ "exec": "./bitcoin-tx",
166+
"args":
167+
["-json",
168+
"-create",
169+
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967293",
170+
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o"],
171+
"output_cmp": "txcreatedata_seq0.json"
172+
},
97173
{ "exec": "./bitcoin-tx",
98174
"args":
99175
["01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000",
100176
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
101177
"output_cmp": "txcreatedata_seq1.hex"
178+
},
179+
{ "exec": "./bitcoin-tx",
180+
"args":
181+
["-json",
182+
"01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000",
183+
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
184+
"output_cmp": "txcreatedata_seq1.json"
102185
}
103186
]

src/test/data/blanktx.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"txid": "d21633ba23f70118185227be58a63527675641ad37967e2aa461559f577aec43",
3+
"version": 1,
4+
"locktime": 0,
5+
"vin": [
6+
],
7+
"vout": [
8+
],
9+
"hex": "01000000000000000000"
10+
}

0 commit comments

Comments
 (0)