* Instantiate a pushdata opcode from * a buffer (will encode minimaldata). * @param {Buffer} data * @returns {Opcode}
(data)
| 431 | */ |
| 432 | |
| 433 | static fromData(data) { |
| 434 | assert(Buffer.isBuffer(data)); |
| 435 | |
| 436 | if (data.length === 1) { |
| 437 | if (data[0] === 0x81) |
| 438 | return this.fromOp(opcodes.OP_1NEGATE); |
| 439 | |
| 440 | if (data[0] >= 1 && data[0] <= 16) |
| 441 | return this.fromOp(data[0] + 0x50); |
| 442 | } |
| 443 | |
| 444 | return this.fromPush(data); |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * Instantiate a pushdata opcode from a |
no test coverage detected