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

Method isProgram

lib/script/script.js:2088–2101  ·  view source on GitHub ↗

* Test whether the output script is a witness program. * Note that this will return true even for malformed * witness v0 programs. * @return {Boolean}

()

Source from the content-addressed store, hash-verified

2086 */
2087
2088 isProgram() {
2089 if (this.raw.length < 4 || this.raw.length > 42)
2090 return false;
2091
2092 if (this.raw[0] !== opcodes.OP_0
2093 && (this.raw[0] < opcodes.OP_1 || this.raw[0] > opcodes.OP_16)) {
2094 return false;
2095 }
2096
2097 if (this.raw[1] + 2 !== this.raw.length)
2098 return false;
2099
2100 return true;
2101 }
2102
2103 /**
2104 * Get the witness program if present.

Callers 7

getProgramMethod · 0.95
forWitnessMethod · 0.95
getAddressInfoMethod · 0.45
fromAddressMethod · 0.45
verifyMethod · 0.45
validateAddressMethod · 0.45
address-test.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected