mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Add P2WSH destination helper and use it instead of manual hashing
This commit is contained in:
@@ -637,9 +637,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||
} else {
|
||||
// Scripts that are not fit for P2WPKH are encoded as P2WSH.
|
||||
// Newer segwit program versions should be considered when then become available.
|
||||
uint256 scriptHash;
|
||||
CSHA256().Write(script.data(), script.size()).Finalize(scriptHash.begin());
|
||||
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(scriptHash));
|
||||
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
||||
}
|
||||
ScriptPubKeyToUniv(segwitScr, sr, true);
|
||||
sr.pushKV("p2sh-segwit", EncodeDestination(CScriptID(segwitScr)));
|
||||
|
||||
Reference in New Issue
Block a user