mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-31 10:41:08 +00:00
Merge bitcoin/bitcoin#31555: descriptor: remove unreachable verification for pkh
366ae00b779acd59a61719422f0597acb17fb3e0 descriptor: Assume `ParseScript` is not being called with a P2WPKH context (brunoerg)
e36640859089baabc46f68217843f96a3ebdc20c 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:
crACK 366ae00b77
achow101:
ACK 366ae00b779acd59a61719422f0597acb17fb3e0
tdb3:
cr ACK 366ae00b779acd59a61719422f0597acb17fb3e0
sipa:
crACK 366ae00b779acd59a61719422f0597acb17fb3e0
Tree-SHA512: b954221a77eed623aeed5eb54f14e82c49540a151d3388831924caa7a784e48a2a975e418af1e13d491e4f8cded3b1797aa39e0e4e39e302a991105df09cdec0
This commit is contained in:
commit
228aba2c4d
@ -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…
x
Reference in New Issue
Block a user