@@ -1287,13 +1287,33 @@ std::unique_ptr<PubkeyProvider> InferXOnlyPubkey(const XOnlyPubKey& xkey, ParseS
1287
1287
return key_provider;
1288
1288
}
1289
1289
1290
+ std::unique_ptr<DescriptorImpl> InferMultiA (const CScript& script, ParseScriptContext ctx, const SigningProvider& provider)
1291
+ {
1292
+ auto match = MatchMultiA (script);
1293
+ if (!match) return {};
1294
+ std::vector<std::unique_ptr<PubkeyProvider>> keys;
1295
+ keys.reserve (match->second .size ());
1296
+ for (const auto keyspan : match->second ) {
1297
+ if (keyspan.size () != 32 ) return {};
1298
+ auto key = InferXOnlyPubkey (XOnlyPubKey{keyspan}, ctx, provider);
1299
+ if (!key) return {};
1300
+ keys.push_back (std::move (key));
1301
+ }
1302
+ return std::make_unique<MultiADescriptor>(match->first , std::move (keys));
1303
+ }
1304
+
1290
1305
std::unique_ptr<DescriptorImpl> InferScript (const CScript& script, ParseScriptContext ctx, const SigningProvider& provider)
1291
1306
{
1292
1307
if (ctx == ParseScriptContext::P2TR && script.size () == 34 && script[0 ] == 32 && script[33 ] == OP_CHECKSIG) {
1293
1308
XOnlyPubKey key{Span{script}.subspan (1 , 32 )};
1294
1309
return std::make_unique<PKDescriptor>(InferXOnlyPubkey (key, ctx, provider));
1295
1310
}
1296
1311
1312
+ if (ctx == ParseScriptContext::P2TR) {
1313
+ auto ret = InferMultiA (script, ctx, provider);
1314
+ if (ret) return ret;
1315
+ }
1316
+
1297
1317
std::vector<std::vector<unsigned char >> data;
1298
1318
TxoutType txntype = Solver (script, data);
1299
1319
0 commit comments