Skip to content

Commit 12ddd66

Browse files
committed
descriptor: add test cases for invalid rawtr() inputs
Also extend the pk() test cases to cover the new x-only behaviour for non-taproot descriptors.
1 parent 0daded6 commit 12ddd66

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/ctest/test_descriptor.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ static struct wally_map_item g_key_map_items[] = {
4242
{ B("mainnet_xpub"), B("xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL") },
4343
{ B("mainnet_xpriv"), B("xprvA2YKGLieCs6cWCiczALiH1jzk3VCCS5M1pGQfWPkamCdR9UpBgE2Gb8AKAyVjKHkz8v37avcfRjdcnP19dVAmZrvZQfvTcXXSAiFNQ6tTtU") },
4444
{ B("uncompressed"), B("0414fc03b8df87cd7b872996810db8458d61da8448e531569c8517b469a119d267be5645686309c6e6736dbd93940707cc9143d3cf29f1b877ff340e2cb2d259cf") },
45+
{ B("x_only"), B("b71aa79cab0ae2d83b82d44cbdc23f5dcca3797e8ba622c4e45a8f7dce28ba0e") },
46+
{ B("non_x_only"), B("03b71aa79cab0ae2d83b82d44cbdc23f5dcca3797e8ba622c4e45a8f7dce28ba0e") }
4547
};
4648

4749
static const struct wally_map g_key_map = {
@@ -897,7 +899,7 @@ static const struct descriptor_test {
897899
"d959hk4q"
898900
},
899901
/*
900-
* Taproot cases
902+
* Miniscript taproot cases
901903
*/
902904
{
903905
"miniscript - taproot raw pubkey",
@@ -1139,6 +1141,14 @@ static const struct descriptor_test {
11391141
"descriptor - pk - non-key child",
11401142
"pk(1)",
11411143
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1144+
},{
1145+
"descriptor - pk - invalid public key",
1146+
"pk(uncompresseduncompressed)",
1147+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1148+
},{
1149+
"descriptor - pk - x-only child",
1150+
"pk(x_only)",
1151+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
11421152
},{
11431153
"descriptor - pk - multi-child",
11441154
"pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)",
@@ -1251,6 +1261,26 @@ static const struct descriptor_test {
12511261
"descriptor - raw - any parent",
12521262
"pk(raw(000102030405060708090a0b0c0d0e0f))",
12531263
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1264+
},{
1265+
"descriptor - empty rawtr",
1266+
"rawtr()",
1267+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1268+
},{
1269+
"descriptor - rawtr - multi-child",
1270+
"rawtr(x_only,x_only)",
1271+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1272+
},{
1273+
"descriptor - rawtr - any parent",
1274+
"pk(rawtr(x_only))",
1275+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1276+
},{
1277+
"descriptor - rawtr - uncompressed key",
1278+
"rawtr(uncompressed)",
1279+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
1280+
},{
1281+
"descriptor - rawtr - invalid public key",
1282+
"rawtr(uncompresseduncompressed)",
1283+
WALLY_NETWORK_BITCOIN_MAINNET, 0, 0, 0, NULL, 0, NULL, ""
12541284
},{
12551285
"descriptor - after - non number child",
12561286
"wsh(after(key_1))",

0 commit comments

Comments
 (0)