mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Add signing support for (sorted)multi_a scripts
This commit is contained in:
parent
3eed6fca57
commit
c17c6aa08d
1 changed files with 23 additions and 0 deletions
|
@ -174,6 +174,29 @@ static bool SignTaprootScript(const SigningProvider& provider, const BaseSignatu
|
||||||
result = Vector(std::move(sig));
|
result = Vector(std::move(sig));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi_a scripts (<key> OP_CHECKSIG <key> OP_CHECKSIGADD <key> OP_CHECKSIGADD <k> OP_NUMEQUAL)
|
||||||
|
if (auto match = MatchMultiA(script)) {
|
||||||
|
std::vector<std::vector<unsigned char>> sigs;
|
||||||
|
int good_sigs = 0;
|
||||||
|
for (size_t i = 0; i < match->second.size(); ++i) {
|
||||||
|
XOnlyPubKey pubkey{*(match->second.rbegin() + i)};
|
||||||
|
std::vector<unsigned char> sig;
|
||||||
|
bool good_sig = CreateTaprootScriptSig(creator, sigdata, provider, sig, pubkey, leaf_hash, sigversion);
|
||||||
|
if (good_sig && good_sigs < match->first) {
|
||||||
|
++good_sigs;
|
||||||
|
sigs.push_back(std::move(sig));
|
||||||
|
} else {
|
||||||
|
sigs.emplace_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (good_sigs == match->first) {
|
||||||
|
result = std::move(sigs);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue