mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Merge bitcoin/bitcoin#31555: descriptor: remove unreachable verification for pkh
366ae00b77
descriptor: Assume `ParseScript` is not being called with a P2WPKH context (brunoerg)e366408590
descriptor: remove unreachable verification for `pkh` (brunoerg) Pull request description: This PR removes an unreachable verification in the `ParseScript` function. It returns an error if `pkh` is not being used at top level, sh, wsh or tr. However, any usage of `pkh` without these contexts will not reach this verification but other ones like "invalid keys" (e.g. `wpkh(pkh(L4gM1FBdyHNpkzsFh9ipnofLhpZRp2mwobpeULy1a6dBTvw8Ywtd))`). ACKs for top commit: davidgumberg: crACK366ae00b77
achow101: ACK366ae00b77
tdb3: cr ACK366ae00b77
sipa: crACK366ae00b77
Tree-SHA512: b954221a77eed623aeed5eb54f14e82c49540a151d3388831924caa7a784e48a2a975e418af1e13d491e4f8cded3b1797aa39e0e4e39e302a991105df09cdec0
This commit is contained in:
commit
228aba2c4d
1 changed files with 1 additions and 5 deletions
|
@ -1761,7 +1761,7 @@ struct KeyParser {
|
|||
std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index, Span<const char>& sp, ParseScriptContext ctx, FlatSigningProvider& out, std::string& error)
|
||||
{
|
||||
using namespace script;
|
||||
|
||||
Assume(ctx == ParseScriptContext::TOP || ctx == ParseScriptContext::P2SH || ctx == ParseScriptContext::P2WSH || ctx == ParseScriptContext::P2TR);
|
||||
std::vector<std::unique_ptr<DescriptorImpl>> ret;
|
||||
auto expr = Expr(sp);
|
||||
if (Func("pk", expr)) {
|
||||
|
@ -1787,10 +1787,6 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
|
|||
ret.emplace_back(std::make_unique<PKHDescriptor>(std::move(pubkey)));
|
||||
}
|
||||
return ret;
|
||||
} else if (ctx != ParseScriptContext::P2TR && Func("pkh", expr)) {
|
||||
// Under Taproot, always the Miniscript parser deal with it.
|
||||
error = "Can only have pkh at top level, in sh(), wsh(), or in tr()";
|
||||
return {};
|
||||
}
|
||||
if (ctx == ParseScriptContext::TOP && Func("combo", expr)) {
|
||||
auto pubkeys = ParsePubkey(key_exp_index, expr, ctx, out, error);
|
||||
|
|
Loading…
Add table
Reference in a new issue