Skip to content

Commit 91ccef3

Browse files
committed
tests: add tests for script tree
1 parent fc1f1b2 commit 91ccef3

File tree

1 file changed

+206
-0
lines changed

1 file changed

+206
-0
lines changed

test/fixtures/p2tr.json

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,212 @@
9292
"input": null,
9393
"witness": null
9494
}
95+
},
96+
{
97+
"description": "address, pubkey, output and hash from internalPubkey and a script tree with one leaf",
98+
"arguments": {
99+
"internalPubkey": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
100+
"scriptsTree": [
101+
{
102+
"output": "83d8ee77a0f3a32a5cea96fd1624d623b836c1e5d1ac2dcde46814b619320c18 OP_CHECKSIG"
103+
}
104+
]
105+
},
106+
"expected": {
107+
"name": "p2tr",
108+
"address": "bc1pjegs09vkeder9m4sw3ycjf2rnpa8nljdqmuleunk9eshu8cq3xysvhgp2u",
109+
"pubkey": "9651079596cb7232eeb07449892543987a79fe4d06f9fcf2762e617e1f008989",
110+
"output": "OP_1 9651079596cb7232eeb07449892543987a79fe4d06f9fcf2762e617e1f008989",
111+
"hash": "16e3f3b8b9c1e453c56b547785cdd25259d65823a2064f30783acc58ef012633",
112+
"signature": null,
113+
"input": null,
114+
"witness": null
115+
}
116+
},
117+
{
118+
"description": "address, pubkey, output and hash from internalPubkey and a script tree with two leafs",
119+
"arguments": {
120+
"internalPubkey": "2258b1c3160be0864a541854eec9164a572f094f7562628281a8073bb89173a7",
121+
"scriptsTree": [
122+
{
123+
"output": "d826a0a53abb6ffc60df25b9c152870578faef4b2eb5a09bdd672bbe32cdd79b OP_CHECKSIG"
124+
},
125+
{
126+
"output": "d826a0a53abb6ffc60df25b9c152870578faef4b2eb5a09bdd672bbe32cdd79b OP_CHECKSIG"
127+
}
128+
]
129+
},
130+
"expected": {
131+
"name": "p2tr",
132+
"address": "bc1ptj0v8rwcj6s36p4r26ws6htx0fct43n0mxdvdeh9043whlxlq3kq9965ke",
133+
"pubkey": "5c9ec38dd896a11d06a3569d0d5d667a70bac66fd99ac6e6e57d62ebfcdf046c",
134+
"output": "OP_1 5c9ec38dd896a11d06a3569d0d5d667a70bac66fd99ac6e6e57d62ebfcdf046c",
135+
"hash": "ce00198cd4667abae1f94aa5862d089e2967af5aec20715c692db74e3d66bb73",
136+
"signature": null,
137+
"input": null,
138+
"witness": null
139+
}
140+
},
141+
{
142+
"description": "address, pubkey, output and hash from internalPubkey and a script tree with three leafs",
143+
"arguments": {
144+
"internalPubkey": "7631cacec3343052d87ef4d0065f61dde82d7d2db0c1cc02ef61ef3c982ea763",
145+
"scriptsTree": [
146+
{
147+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
148+
},
149+
[
150+
{
151+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
152+
},
153+
{
154+
"output": "9b4d495b74887815a1ff623c055c6eac6b6b2e07d2a016d6526ebac71dd99744 OP_CHECKSIG"
155+
}
156+
]
157+
]
158+
},
159+
"expected": {
160+
"name": "p2tr",
161+
"address": "bc1pkq0t8nkmqswn3qjg9uy6ux2hsyyz4as25v8unfjc9s8q2e4c00sqku9lxh",
162+
"pubkey": "b01eb3cedb041d3882482f09ae195781082af60aa30fc9a6582c0e0566b87be0",
163+
"output": "OP_1 b01eb3cedb041d3882482f09ae195781082af60aa30fc9a6582c0e0566b87be0",
164+
"hash": "7ae0cc2057b1a7bf0e09c787e1d7b6b2355ac112a7b80380a5c1e942155b0c0f",
165+
"signature": null,
166+
"input": null,
167+
"witness": null
168+
}
169+
},
170+
{
171+
"description": "address, pubkey, output and hash from internalPubkey and a script tree with four leafs",
172+
"arguments": {
173+
"internalPubkey": "d0c19def28bb1b39451c1a814737615983967780d223b79969ba692182c6006b",
174+
"scriptsTree": [
175+
[
176+
{
177+
"output": "9b4d495b74887815a1ff623c055c6eac6b6b2e07d2a016d6526ebac71dd99744 OP_CHECKSIG"
178+
},
179+
{
180+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
181+
}
182+
],
183+
[
184+
{
185+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
186+
},
187+
{
188+
"output": "9b4d495b74887815a1ff623c055c6eac6b6b2e07d2a016d6526ebac71dd99744 OP_CHECKSIG"
189+
}
190+
]
191+
]
192+
},
193+
"expected": {
194+
"name": "p2tr",
195+
"address": "bc1pstdzevc40j059s0473rghhv9e05l9f5xv7l6dtlavvq22rzfna3syjvjut",
196+
"pubkey": "82da2cb3157c9f42c1f5f4468bdd85cbe9f2a68667bfa6affd6300a50c499f63",
197+
"output": "OP_1 82da2cb3157c9f42c1f5f4468bdd85cbe9f2a68667bfa6affd6300a50c499f63",
198+
"hash": "d673e784eac9b70289130a0bd359023a0fbdde51dc069b9efb4157c2cdce3ea5",
199+
"signature": null,
200+
"input": null,
201+
"witness": null
202+
}
203+
},
204+
{
205+
"description": "address, pubkey, output and hash from internalPubkey and a script tree with seven leafs",
206+
"arguments": {
207+
"internalPubkey": "f95886b02a84928c5c15bdca32784993105f73de27fa6ad8c1a60389b999267c",
208+
"scriptsTree": [
209+
[
210+
{
211+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
212+
},
213+
[
214+
{
215+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
216+
},
217+
{
218+
"output": "2258b1c3160be0864a541854eec9164a572f094f7562628281a8073bb89173a7 OP_CHECKSIG"
219+
}
220+
]
221+
],
222+
[
223+
{
224+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
225+
},
226+
[
227+
{
228+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
229+
},
230+
[
231+
{
232+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
233+
},
234+
{
235+
"output": "03a669ea926f381582ec4a000b9472ba8a17347f5fb159eddd4a07036a6718eb OP_CHECKSIG"
236+
}
237+
]
238+
]
239+
]
240+
]
241+
},
242+
"expected": {
243+
"name": "p2tr",
244+
"address": "bc1pfas4r5s5208puwzj20hvwg2dw2kanc06yxczzdd66729z63pk43q7zwlu6",
245+
"pubkey": "4f6151d21453ce1e385253eec7214d72add9e1fa21b02135bad794516a21b562",
246+
"output": "OP_1 4f6151d21453ce1e385253eec7214d72add9e1fa21b02135bad794516a21b562",
247+
"hash": "16fb2e99bdf86f67ee6980d0418658f15df7e19476053b58f45a89df2e219b1b",
248+
"signature": null,
249+
"input": null,
250+
"witness": null
251+
}
252+
},
253+
{
254+
"description": "address, pubkey, output and hash from internalPubkey and a script tree with seven leafs (2)",
255+
"arguments": {
256+
"internalPubkey": "aba457d16a8d59151c387f24d1eb887efbe24644c1ee64b261282e7baebdb247",
257+
"scriptsTree": [
258+
{
259+
"output": "00a9da96087a72258f83b338ef7f0ea8cbbe05da5f18f091eb397d1ecbf7c3d3 OP_CHECKSIG"
260+
},
261+
[
262+
[
263+
{
264+
"output": "00a9da96087a72258f83b338ef7f0ea8cbbe05da5f18f091eb397d1ecbf7c3d3 OP_CHECKSIG"
265+
},
266+
[
267+
{
268+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
269+
},
270+
{
271+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
272+
}
273+
]
274+
],
275+
[
276+
[
277+
{
278+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
279+
},
280+
{
281+
"output": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 OP_CHECKSIG"
282+
}
283+
],
284+
{
285+
"output": "00a9da96087a72258f83b338ef7f0ea8cbbe05da5f18f091eb397d1ecbf7c3d3 OP_CHECKSIG"
286+
}
287+
]
288+
]
289+
]
290+
},
291+
"expected": {
292+
"name": "p2tr",
293+
"address": "bc1pmu8qwr9zljs9anger0d6q3uyr43yzjetmjmzf8p93ltycrwj28lsee3e0n",
294+
"pubkey": "df0e070ca2fca05ecd191bdba047841d62414b2bdcb6249c258fd64c0dd251ff",
295+
"output": "OP_1 df0e070ca2fca05ecd191bdba047841d62414b2bdcb6249c258fd64c0dd251ff",
296+
"hash": "027391d0aac8d94725e4fcec4b07214d7c8a14bcdca2b1c08e4bc786308bdae5",
297+
"signature": null,
298+
"input": null,
299+
"witness": null
300+
}
95301
}
96302
],
97303
"invalid": [

0 commit comments

Comments
 (0)