mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
rpc: Use FlatSigningProvider in decodescript
Using a FillableSigningProvider results in decodescript being unable to infer descriptors for scripts larger than 520 bytes. Using a FlatSigningProvider resolves this.
This commit is contained in:
parent
75f0e0b607
commit
7cc7822371
1 changed files with 2 additions and 2 deletions
|
@ -522,14 +522,14 @@ static RPCHelpMan decodescript()
|
||||||
if (can_wrap_P2WSH) {
|
if (can_wrap_P2WSH) {
|
||||||
UniValue sr(UniValue::VOBJ);
|
UniValue sr(UniValue::VOBJ);
|
||||||
CScript segwitScr;
|
CScript segwitScr;
|
||||||
FillableSigningProvider provider;
|
FlatSigningProvider provider;
|
||||||
if (which_type == TxoutType::PUBKEY) {
|
if (which_type == TxoutType::PUBKEY) {
|
||||||
segwitScr = GetScriptForDestination(WitnessV0KeyHash(Hash160(solutions_data[0])));
|
segwitScr = GetScriptForDestination(WitnessV0KeyHash(Hash160(solutions_data[0])));
|
||||||
} else if (which_type == TxoutType::PUBKEYHASH) {
|
} else if (which_type == TxoutType::PUBKEYHASH) {
|
||||||
segwitScr = GetScriptForDestination(WitnessV0KeyHash(uint160{solutions_data[0]}));
|
segwitScr = GetScriptForDestination(WitnessV0KeyHash(uint160{solutions_data[0]}));
|
||||||
} else {
|
} else {
|
||||||
// Scripts that are not fit for P2WPKH are encoded as P2WSH.
|
// Scripts that are not fit for P2WPKH are encoded as P2WSH.
|
||||||
provider.AddCScript(script);
|
provider.scripts[CScriptID(script)] = script;
|
||||||
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
||||||
}
|
}
|
||||||
ScriptToUniv(segwitScr, /*out=*/sr, /*include_hex=*/true, /*include_address=*/true, /*provider=*/&provider);
|
ScriptToUniv(segwitScr, /*out=*/sr, /*include_hex=*/true, /*include_address=*/true, /*provider=*/&provider);
|
||||||
|
|
Loading…
Reference in a new issue