MCPcopy Create free account
hub / github.com/LUX-Core/lux / CreateMultisigRedeemscript

Function CreateMultisigRedeemscript

src/rpcutil.cpp:50–70  ·  view source on GitHub ↗

Creates a multisig redeemscript from a given list of public keys and number required.

Source from the content-addressed store, hash-verified

48
49// Creates a multisig redeemscript from a given list of public keys and number required.
50CScript CreateMultisigRedeemscript(const int required, const std::vector<CPubKey>& pubkeys)
51{
52 // Gather public keys
53 if (required < 1) {
54 throw JSONRPCError(RPC_INVALID_PARAMETER, "a multisignature address must require at least one key to redeem");
55 }
56 if ((int)pubkeys.size() < required) {
57 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("not enough keys supplied (got %u keys, but need at least %d to redeem)", pubkeys.size(), required));
58 }
59 if (pubkeys.size() > 16) {
60 throw JSONRPCError(RPC_INVALID_PARAMETER, "Number of keys involved in the multisignature address creation > 16\nReduce the number");
61 }
62
63 CScript result = GetScriptForMultisig(required, pubkeys);
64
65 if (result.size() > MAX_SCRIPT_ELEMENT_SIZE) {
66 throw JSONRPCError(RPC_INVALID_PARAMETER, (strprintf("redeemScript exceeds size limit: %d > %d", result.size(), MAX_SCRIPT_ELEMENT_SIZE)));
67 }
68
69 return result;
70}

Callers 2

addmultisigaddressFunction · 0.85
createmultisigFunction · 0.85

Calls 3

JSONRPCErrorFunction · 0.85
GetScriptForMultisigFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected