Skip to content

Commit c23fa1d

Browse files
committed
Add test cases
1 parent dfa2ac6 commit c23fa1d

23 files changed

+366
-0
lines changed

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

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,46 @@
8686
"args": ["-json", "-create", "outscript=0:"],
8787
"output_cmp": "txcreate2.json"
8888
},
89+
{ "exec": "./bitcoin-tx",
90+
"args": ["-create", "outscript=0:OP_DROP"],
91+
"output_cmp": "txcreatescript1.hex",
92+
"description": "Create a new transaction with a single output script (OP_DROP)"
93+
},
94+
{ "exec": "./bitcoin-tx",
95+
"args": ["-json", "-create", "outscript=0:OP_DROP"],
96+
"output_cmp": "txcreatescript1.json",
97+
"description": "Create a new transaction with a single output script (OP_DROP) (output as json)"
98+
},
99+
{ "exec": "./bitcoin-tx",
100+
"args": ["-create", "outscript=0:OP_DROP:S"],
101+
"output_cmp": "txcreatescript2.hex",
102+
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH"
103+
},
104+
{ "exec": "./bitcoin-tx",
105+
"args": ["-json", "-create", "outscript=0:OP_DROP:S"],
106+
"output_cmp": "txcreatescript2.json",
107+
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH (output as json)"
108+
},
109+
{ "exec": "./bitcoin-tx",
110+
"args": ["-create", "outscript=0:OP_DROP:W"],
111+
"output_cmp": "txcreatescript3.hex",
112+
"description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH"
113+
},
114+
{ "exec": "./bitcoin-tx",
115+
"args": ["-json", "-create", "outscript=0:OP_DROP:W"],
116+
"output_cmp": "txcreatescript3.json",
117+
"description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH (output as json)"
118+
},
119+
{ "exec": "./bitcoin-tx",
120+
"args": ["-create", "outscript=0:OP_DROP:WS"],
121+
"output_cmp": "txcreatescript4.hex",
122+
"description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH, wrapped in a P2SH"
123+
},
124+
{ "exec": "./bitcoin-tx",
125+
"args": ["-json", "-create", "outscript=0:OP_DROP:WS"],
126+
"output_cmp": "txcreatescript4.json",
127+
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH, wrapped in a P2SH (output as json)"
128+
},
89129
{ "exec": "./bitcoin-tx",
90130
"args":
91131
["-create",
@@ -107,6 +147,42 @@
107147
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
108148
"output_cmp": "txcreatesign.json"
109149
},
150+
{ "exec": "./bitcoin-tx",
151+
"args":
152+
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397"],
153+
"output_cmp": "txcreateoutpubkey1.hex",
154+
"description": "Creates a new transaction with a single pay-to-pubkey output"
155+
},
156+
{ "exec": "./bitcoin-tx",
157+
"args":
158+
["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397"],
159+
"output_cmp": "txcreateoutpubkey1.json",
160+
"description": "Creates a new transaction with a single pay-to-pubkey output (output as json)"
161+
},
162+
{ "exec": "./bitcoin-tx",
163+
"args":
164+
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W"],
165+
"output_cmp": "txcreateoutpubkey2.hex",
166+
"description": "Creates a new transaction with a single pay-to-witness-pubkey output"
167+
},
168+
{ "exec": "./bitcoin-tx",
169+
"args":
170+
["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W"],
171+
"output_cmp": "txcreateoutpubkey2.json",
172+
"description": "Creates a new transaction with a single pay-to-witness-pubkey output (output as json)"
173+
},
174+
{ "exec": "./bitcoin-tx",
175+
"args":
176+
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS"],
177+
"output_cmp": "txcreateoutpubkey3.hex",
178+
"description": "Creates a new transaction with a single pay-to-witness-pubkey, wrapped in P2SH output"
179+
},
180+
{ "exec": "./bitcoin-tx",
181+
"args":
182+
["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS"],
183+
"output_cmp": "txcreateoutpubkey3.json",
184+
"description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)"
185+
},
110186
{ "exec": "./bitcoin-tx",
111187
"args":
112188
["-create",
@@ -182,5 +258,45 @@
182258
"01000000011f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffff0180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000",
183259
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
184260
"output_cmp": "txcreatedata_seq1.json"
261+
},
262+
{ "exec": "./bitcoin-tx",
263+
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485"],
264+
"output_cmp": "txcreatemultisig1.hex",
265+
"description": "Creates a new transaction with a single 2-of-3 multisig output"
266+
},
267+
{ "exec": "./bitcoin-tx",
268+
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485"],
269+
"output_cmp": "txcreatemultisig1.json",
270+
"description": "Creates a new transaction with a single 2-of-3 multisig output (output in json)"
271+
},
272+
{ "exec": "./bitcoin-tx",
273+
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S"],
274+
"output_cmp": "txcreatemultisig2.hex",
275+
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output"
276+
},
277+
{ "exec": "./bitcoin-tx",
278+
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S"],
279+
"output_cmp": "txcreatemultisig2.json",
280+
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output (output in json)"
281+
},
282+
{ "exec": "./bitcoin-tx",
283+
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W"],
284+
"output_cmp": "txcreatemultisig3.hex",
285+
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output"
286+
},
287+
{ "exec": "./bitcoin-tx",
288+
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W"],
289+
"output_cmp": "txcreatemultisig3.json",
290+
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output (output in json)"
291+
},
292+
{ "exec": "./bitcoin-tx",
293+
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS"],
294+
"output_cmp": "txcreatemultisig4.hex",
295+
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH"
296+
},
297+
{ "exec": "./bitcoin-tx",
298+
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS"],
299+
"output_cmp": "txcreatemultisig4.json",
300+
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH (output in json)"
185301
}
186302
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"txid": "0d1d4edfc217d9db3ab6a9298f26a52eae3c52f55a6cb8ccbc14f7c727572894",
3+
"version": 1,
4+
"locktime": 0,
5+
"vin": [
6+
],
7+
"vout": [
8+
{
9+
"value": 1.00,
10+
"n": 0,
11+
"scriptPubKey": {
12+
"asm": "2 02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d 02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485 3 OP_CHECKMULTISIG",
13+
"hex": "522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae",
14+
"reqSigs": 2,
15+
"type": "multisig",
16+
"addresses": [
17+
"1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz",
18+
"1FXtz9KU8JNmQDyHdiEm5HDiALuP3zdHvV",
19+
"14LuavcBbXZYJ6Tsz3cAUQj9SuQoL2xCQX"
20+
]
21+
}
22+
}
23+
],
24+
"hex": "01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000"
25+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"txid": "0d861f278a3b7bce7cb5a88d71e6e6a903336f95ad5a2c29b295b63835b6eee3",
3+
"version": 1,
4+
"locktime": 0,
5+
"vin": [
6+
],
7+
"vout": [
8+
{
9+
"value": 1.00,
10+
"n": 0,
11+
"scriptPubKey": {
12+
"asm": "OP_HASH160 1c6fbaf46d64221e80cbae182c33ddf81b9294ac OP_EQUAL",
13+
"hex": "a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac87",
14+
"reqSigs": 1,
15+
"type": "scripthash",
16+
"addresses": [
17+
"34HNh57oBCRKkxNyjTuWAJkTbuGh6jg2Ms"
18+
]
19+
}
20+
}
21+
],
22+
"hex": "01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000"
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"txid": "ccc552220b46a3b5140048b03395987ce4f0fa1ddf8c635bba1fa44e0f8c1d7f",
3+
"version": 1,
4+
"locktime": 0,
5+
"vin": [
6+
],
7+
"vout": [
8+
{
9+
"value": 1.00,
10+
"n": 0,
11+
"scriptPubKey": {
12+
"asm": "0 e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f05",
13+
"hex": "0020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f05",
14+
"type": "witness_v0_scripthash"
15+
}
16+
}
17+
],
18+
"hex": "01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000"
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"txid": "5e8b1cc73234e208d4b7ca9075f136b908c34101be7a048df4ba9ac758b61567",
3+
"version": 1,
4+
"locktime": 0,
5+
"vin": [
6+
],
7+
"vout": [
8+
{
9+
"value": 1.00,
10+
"n": 0,
11+
"scriptPubKey": {
12+
"asm": "OP_HASH160 6edf12858999f0dae74f9c692e6694ee3621b2ac OP_EQUAL",
13+
"hex": "a9146edf12858999f0dae74f9c692e6694ee3621b2ac87",
14+
"reqSigs": 1,
15+
"type": "scripthash",
16+
"addresses": [
17+
"3BoFUz1StqcNcgUTZE5cC1eFhuYFzj3fGH"
18+
]
19+
}
20+
}
21+
],
22+
"hex": "01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000"
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000

0 commit comments

Comments
 (0)