* Test whether the output script is nulldata/opreturn. * @param {Boolean} [minimal=false] - Minimaldata only. * @returns {Boolean}
(minimal)
| 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. |
no test coverage detected