MCPcopy Create free account
hub / github.com/bcoin-org/bcoin / isNulldata

Method isNulldata

lib/script/script.js:2005–2034  ·  view source on GitHub ↗

* Test whether the output script is nulldata/opreturn. * @param {Boolean} [minimal=false] - Minimaldata only. * @returns {Boolean}

(minimal)

Source from the content-addressed store, hash-verified

2003 */
2004
2005 isNulldata(minimal) {
2006 if (this.code.length === 0)
2007 return false;
2008
2009 if (this.getOp(0) !== opcodes.OP_RETURN)
2010 return false;
2011
2012 if (this.code.length === 1)
2013 return true;
2014
2015 if (minimal) {
2016 if (this.raw.length > policy.MAX_OP_RETURN_BYTES)
2017 return false;
2018 }
2019
2020 for (let i = 1; i < this.code.length; i++) {
2021 const op = this.code[i];
2022
2023 if (op.value === -1)
2024 return false;
2025
2026 if (op.value > opcodes.OP_16)
2027 return false;
2028
2029 if (minimal && !op.isMinimal())
2030 return false;
2031 }
2032
2033 return true;
2034 }
2035
2036 /**
2037 * Get OP_RETURN data if present.

Callers 6

toASMMethod · 0.95
getTypeMethod · 0.95
isStandardMethod · 0.95
getNulldataMethod · 0.95
checkStandardMethod · 0.80
script-test.jsFile · 0.80

Calls 2

getOpMethod · 0.95
isMinimalMethod · 0.45

Tested by

no test coverage detected