Skip to content

Commit c626439

Browse files
committed
descriptor: add script/addresses/invalid tr(k) test cases
1 parent 2489627 commit c626439

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

src/ctest/test_descriptor.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,18 @@ static const struct descriptor_test {
383383
WALLY_NETWORK_BITCOIN_REGTEST, 0, 0, 0, NULL, 0,
384384
"5120b71aa79cab0ae2d83b82d44cbdc23f5dcca3797e8ba622c4e45a8f7dce28ba0e",
385385
"ha989syu"
386+
},{
387+
"descriptor - tr - x-only",
388+
"tr(x_only)",
389+
WALLY_NETWORK_BITCOIN_REGTEST, 0, 0, 0, NULL, 0,
390+
"51205fb8e39dbbdc7c831af59e44a9b2997f9daaf72c3e965b30982f3c731539e1db",
391+
"axny68jy"
392+
},{
393+
"descriptor - tr - non-x-only returns the same script as x-only",
394+
"tr(non_x_only)",
395+
WALLY_NETWORK_BITCOIN_REGTEST, 0, 0, 0, NULL, 0,
396+
"51205fb8e39dbbdc7c831af59e44a9b2997f9daaf72c3e965b30982f3c731539e1db",
397+
"tp2ky708"
386398
},{
387399
"descriptor - A single key",
388400
"wsh(c:pk_k(key_1))",
@@ -1293,6 +1305,26 @@ static const struct descriptor_test {
12931305
"descriptor - rawtr - invalid public key",
12941306
"rawtr(uncompresseduncompressed)",
12951307
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1308+
},{
1309+
"descriptor - empty tr",
1310+
"tr()",
1311+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1312+
},{
1313+
"descriptor - tr - multi-child",
1314+
"tr(x_only,x_only)", /* FIXME: delete this case when script path is supported */
1315+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1316+
},{
1317+
"descriptor - tr - any parent",
1318+
"pk(tr(x_only))",
1319+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1320+
},{
1321+
"descriptor - tr - uncompressed key",
1322+
"tr(uncompressed)",
1323+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1324+
},{
1325+
"descriptor - tr - invalid public key",
1326+
"tr(uncompresseduncompressed)",
1327+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
12961328
},{
12971329
"descriptor - after - non number child",
12981330
"wsh(after(key_1))",
@@ -1792,6 +1824,24 @@ static const struct address_test {
17921824
"bcrt1p9s6clznyy4enaplm2ak9fa0t3d66s5q5m4khpg7w00w9wuerp93q88e9ql",
17931825
"bcrt1p220y7newnya8fk04079hcvd3cupx6t8ta659nayh8kaav39f3scsf63y8h",
17941826
}
1827+
}, {
1828+
"address - tr (x-only)",
1829+
"tr(x_only)",
1830+
WALLY_NETWORK_BITCOIN_REGTEST,
1831+
0, 0, 0,
1832+
ADDR("bcrt1pt7uw88dmm37gxxh4nez2nv5e07w64aev86t9kvyc9u78x9feu8dsp5hh3s")
1833+
}, {
1834+
"address list - tr (5-9)",
1835+
"tr([59d1f3b0/86'/1'/0']tpubDC2Q4xK4XH72Gow34bNSZpx7uPcg1gfu6hPACSSieETYzpWgywMLmi2Yz9STA2Nrif3Yav7jvkzSj8q3nDKjjQrEfRYckUj5jsadYCdCw1C/0/*)#9wpuzyss",
1836+
WALLY_NETWORK_BITCOIN_REGTEST,
1837+
0, 0, 5, 5,
1838+
{
1839+
"bcrt1p3hf8e9tczepujy3fe66wgq9ez5tllqkschupy08pfzukjtye5wksgtj5k2",
1840+
"bcrt1p9wut0rvmq347rldeyktdn9qmrj9qk9ynefykruxrp4yr9u27pzvqfd6ktq",
1841+
"bcrt1p3kjmw33umzaylvdmglk489vd4ph2te67ged3c4fmk20adn0pfknsm5jmvu",
1842+
"bcrt1pz6t2y0qg69594u60qmnlq23rezxseyf65qk0xl2kt7l02y8rcs8qndm2sm",
1843+
"bcrt1p2nunl5trs2hfrlu5fp6kg3hu3tffpzg0w5m56mpmx8m96pl0qxnszgdnaw",
1844+
}
17951845
},
17961846
/*
17971847
* Multi-path

0 commit comments

Comments
 (0)