* Test a script to see if it is likely * to be script code (no weird opcodes). * @returns {Boolean}
()
| 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. |
no test coverage detected