MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CreateMultisigRedeemscript

Function CreateMultisigRedeemscript

src/rpc/util.cpp:47–67  ·  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

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