mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Make and get the multisig redeemscript and destination in one function instead of two
Instead of creating a redeemScript with CreateMultisigRedeemscript and then getting the destination with AddAndGetDestinationForScript, do both in the same function. CreateMultisigRedeemscript is changed to AddAndGetMultisigDestination. It creates the redeemScript and returns it via an output parameter. Then it calls AddAndGetDestinationForScript to add the destination to the keystore and get the proper destination. This allows us to inspect the public keys in the redeemScript before creating the destination so that the correct destination is used when uncompressed pubkeys are in the multisig.
This commit is contained in:
@@ -130,9 +130,9 @@ static UniValue createmultisig(const JSONRPCRequest& request)
|
||||
}
|
||||
|
||||
// Construct using pay-to-script-hash:
|
||||
const CScript inner = CreateMultisigRedeemscript(required, pubkeys);
|
||||
CBasicKeyStore keystore;
|
||||
const CTxDestination dest = AddAndGetDestinationForScript(keystore, inner, output_type);
|
||||
CScript inner;
|
||||
const CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, keystore, inner);
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("address", EncodeDestination(dest));
|
||||
|
||||
Reference in New Issue
Block a user