* Hash the transaction with the non-witness serialization. * @param {String?} enc - Can be `'hex'` or `null`. * @returns {Hash|Buffer} hash
(enc)
| 176 | */ |
| 177 | |
| 178 | hash(enc) { |
| 179 | let h = this._hash; |
| 180 | |
| 181 | if (!h) { |
| 182 | h = hash256.digest(this.toNormal()); |
| 183 | if (!this.mutable) |
| 184 | this._hash = h; |
| 185 | } |
| 186 | |
| 187 | if (enc === 'hex') { |
| 188 | let hex = this._hhash; |
| 189 | if (!hex) { |
| 190 | hex = h.toString('hex'); |
| 191 | if (!this.mutable) |
| 192 | this._hhash = hex; |
| 193 | } |
| 194 | h = hex; |
| 195 | } |
| 196 | |
| 197 | return h; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Hash the transaction with the witness |
no test coverage detected