MCPcopy Index your code
hub / github.com/bcoin-org/bcoin / isCode

Method isCode

lib/script/script.js:1379–1404  ·  view source on GitHub ↗

* Test a script to see if it is likely * to be script code (no weird opcodes). * @returns {Boolean}

()

Source from the content-addressed store, hash-verified

1377 */
1378
1379 isCode() {
1380 for (const op of this.code) {
1381 if (op.value === -1)
1382 return false;
1383
1384 if (op.isDisabled())
1385 return false;
1386
1387 switch (op.value) {
1388 case opcodes.OP_RESERVED:
1389 case opcodes.OP_NOP:
1390 case opcodes.OP_VER:
1391 case opcodes.OP_VERIF:
1392 case opcodes.OP_VERNOTIF:
1393 case opcodes.OP_RESERVED1:
1394 case opcodes.OP_RESERVED2:
1395 case opcodes.OP_NOP1:
1396 return false;
1397 }
1398
1399 if (op.value > opcodes.OP_CHECKSEQUENCEVERIFY)
1400 return false;
1401 }
1402
1403 return true;
1404 }
1405
1406 /**
1407 * Inject properties from a pay-to-pubkey script.

Callers 1

isScripthashInputMethod · 0.80

Calls 1

isDisabledMethod · 0.80

Tested by

no test coverage detected