MCPcopy
hub / github.com/bcoin-org/bcoin / fromMultisig

Method fromMultisig

lib/script/script.js:1486–1504  ·  view source on GitHub ↗

* Inject properties from pay-to-multisig script. * @private * @param {Number} m * @param {Number} n * @param {Buffer[]} keys

(m, n, keys)

Source from the content-addressed store, hash-verified

1484 */
1485
1486 fromMultisig(m, n, keys) {
1487 assert((m & 0xff) === m && (n & 0xff) === n);
1488 assert(Array.isArray(keys));
1489 assert(keys.length === n, '`n` keys are required for multisig.');
1490 assert(m >= 1 && m <= n);
1491 assert(n >= 1 && n <= 15);
1492
1493 this.clear();
1494
1495 this.pushSmall(m);
1496
1497 for (const key of sortKeys(keys))
1498 this.pushData(key);
1499
1500 this.pushSmall(n);
1501 this.pushOp(opcodes.OP_CHECKMULTISIG);
1502
1503 return this.compile();
1504 }
1505
1506 /**
1507 * Create a pay-to-multisig script.

Callers 8

deriveKeyMethod · 0.80
createMultisigMethod · 0.80
keyring-test.jsFile · 0.80
wallet-test.jsFile · 0.80
node-http-test.jsFile · 0.80
tx-test.jsFile · 0.80
wallet-rpc-test.jsFile · 0.80
randomMultisigFunction · 0.80

Calls 6

clearMethod · 0.95
pushSmallMethod · 0.95
pushDataMethod · 0.95
pushOpMethod · 0.95
compileMethod · 0.95
sortKeysFunction · 0.85

Tested by

no test coverage detected