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

Method fromData

lib/script/opcode.js:433–445  ·  view source on GitHub ↗

* Instantiate a pushdata opcode from * a buffer (will encode minimaldata). * @param {Buffer} data * @returns {Opcode}

(data)

Source from the content-addressed store, hash-verified

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

Callers 9

fromStringMethod · 0.95
fromNumMethod · 0.95
setDataMethod · 0.80
pushDataMethod · 0.80
unshiftDataMethod · 0.80
insertDataMethod · 0.80
mempool-test.jsFile · 0.80
indexer-test.jsFile · 0.80
tx-test.jsFile · 0.80

Calls 2

fromOpMethod · 0.95
fromPushMethod · 0.95

Tested by

no test coverage detected