mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-12 07:39:41 +02:00
Merge bitcoin/bitcoin#27113: rpc: Use a FlatSigningProvider in decodescript to allow inferring descriptors for scripts larger than 520 bytes
73ec4b2a83tests: decodescript can infer descriptors for scripts >520 bytes (Andrew Chow)7cc7822371rpc: Use FlatSigningProvider in decodescript (Andrew Chow) Pull request description: `FillableSigningProvider` limits scripts to 520 bytes even though segwit allows scripts to be larger than that. We can avoid this limit by using a `FlatSigningProvider` so that such larger scripts can be decoded. Fixes #27111 ACKs for top commit: instagibbs: ACK73ec4b2a83Tree-SHA512: c0e6d21025e2da864471989ac94c54e127d05459b9b048f34a0da8d76d8e372d5472a2e667ba2db74d6286e3e6faa55486ffa9232a068b519afa676394031d5a
This commit is contained in:
@@ -522,14 +522,14 @@ static RPCHelpMan decodescript()
|
||||
if (can_wrap_P2WSH) {
|
||||
UniValue sr(UniValue::VOBJ);
|
||||
CScript segwitScr;
|
||||
FillableSigningProvider provider;
|
||||
FlatSigningProvider provider;
|
||||
if (which_type == TxoutType::PUBKEY) {
|
||||
segwitScr = GetScriptForDestination(WitnessV0KeyHash(Hash160(solutions_data[0])));
|
||||
} else if (which_type == TxoutType::PUBKEYHASH) {
|
||||
segwitScr = GetScriptForDestination(WitnessV0KeyHash(uint160{solutions_data[0]}));
|
||||
} else {
|
||||
// Scripts that are not fit for P2WPKH are encoded as P2WSH.
|
||||
provider.AddCScript(script);
|
||||
provider.scripts[CScriptID(script)] = script;
|
||||
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
||||
}
|
||||
ScriptToUniv(segwitScr, /*out=*/sr, /*include_hex=*/true, /*include_address=*/true, /*provider=*/&provider);
|
||||
|
||||
Reference in New Issue
Block a user