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

Method hash

lib/primitives/tx.js:178–198  ·  view source on GitHub ↗

* Hash the transaction with the non-witness serialization. * @param {String?} enc - Can be `'hex'` or `null`. * @returns {Hash|Buffer} hash

(enc)

Source from the content-addressed store, hash-verified

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

Callers 15

witnessHashMethod · 0.95
isWatchedMethod · 0.95
rhashMethod · 0.95
toInvMethod · 0.95
sigopContextFunction · 0.95
createGenesisBlockFunction · 0.95
coins.jsFile · 0.45
_sendMethod · 0.45
increaseFeeMethod · 0.45
importPrunedFundsMethod · 0.45
initRouterMethod · 0.45
addMethod · 0.45

Calls 2

toNormalMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected