@@ -693,6 +693,15 @@ static int verify_raw(ms_ctx *ctx, ms_node *node)
693693 return WALLY_OK ;
694694}
695695
696+ static int verify_raw_tr (ms_ctx * ctx , ms_node * node )
697+ {
698+ if (node -> child -> builtin || !(node -> child -> kind & KIND_KEY ) ||
699+ node_has_uncompressed_key (ctx , node ))
700+ return WALLY_EINVAL ;
701+ node -> type_properties = builtin_get (node )-> type_properties ;
702+ return WALLY_OK ;
703+ }
704+
696705static int verify_delay (ms_ctx * ctx , ms_node * node )
697706{
698707 (void )ctx ;
@@ -1380,6 +1389,21 @@ static int generate_raw(ms_ctx *ctx, ms_node *node,
13801389 return * written > REDEEM_SCRIPT_MAX_SIZE ? WALLY_EINVAL : ret ;
13811390}
13821391
1392+ static int generate_raw_tr (ms_ctx * ctx , ms_node * node ,
1393+ unsigned char * script , size_t script_len , size_t * written )
1394+ {
1395+ int ret = WALLY_OK ;
1396+
1397+ if (script_len >= WALLY_SCRIPTPUBKEY_P2TR_LEN ) {
1398+ script [0 ] = OP_1 ;
1399+ const bool force_xonly = true;
1400+ ret = generate_pk_k_impl (ctx , node , script + 1 , script_len - 1 ,
1401+ force_xonly , written );
1402+ }
1403+ * written = WALLY_SCRIPTPUBKEY_P2TR_LEN ;
1404+ return ret ;
1405+ }
1406+
13831407static int generate_delay (ms_ctx * ctx , ms_node * node ,
13841408 unsigned char * script , size_t script_len , size_t * written )
13851409{
@@ -1788,6 +1812,11 @@ static const struct ms_builtin_t g_builtins[] = {
17881812 KIND_DESCRIPTOR_RAW ,
17891813 TYPE_NONE ,
17901814 0xffffffff , verify_raw , generate_raw
1815+ }, {
1816+ I_NAME ("rawtr" ),
1817+ KIND_DESCRIPTOR_RAW_TR ,
1818+ TYPE_NONE ,
1819+ 1 , verify_raw_tr , generate_raw_tr
17911820 },
17921821 /* miniscript */
17931822 {
@@ -2472,6 +2501,9 @@ static int node_generation_size(const ms_node *node, size_t *total)
24722501 case KIND_DESCRIPTOR_RAW :
24732502 /* No-op */
24742503 break ;
2504+ case KIND_DESCRIPTOR_RAW_TR :
2505+ * total += WALLY_SCRIPTPUBKEY_P2TR_LEN ;
2506+ break ;
24752507 case KIND_MINISCRIPT_PK_K :
24762508 * total += 1 ;
24772509 break ;
0 commit comments