MCPcopy Create free account
hub / github.com/chain/txvm / WriteWitnessCommitmentTo

Method WriteWitnessCommitmentTo

protocol/bc/tx.go:260–272  ·  view source on GitHub ↗

WriteWitnessCommitmentTo writes the "Transaction Witness Commitment" to w, consisting of the version, runlimit, and program in a tuple, encoded according to standard txvm convention, hashed together with the txid. The only errors returned are those from w.

(w io.Writer)

Source from the content-addressed store, hash-verified

258//
259// The only errors returned are those from w.
260func (tx *Tx) WriteWitnessCommitmentTo(w io.Writer) (int, error) {
261 // See $I10R/docs/future/protocol/specifications/blockchain.md#transaction-witness-commitment
262 // for the definition of the transaction witness commitment.
263 n, err := tx.ID.WriteTo(w)
264 if err != nil {
265 return int(n), err
266 }
267 n2, err := tx.writeWitnessHashTo(w)
268 if err != nil {
269 return int(n) + n2, err
270 }
271 return int(n) + n2, nil
272}
273
274// The only errors returned are those from w.
275func (tx *Tx) writeWitnessHashTo(w io.Writer) (int, error) {

Callers 3

TestWitnessHashFunction · 0.95
NewCommitmentsTxFunction · 0.80
TxMerkleRootFunction · 0.80

Calls 2

writeWitnessHashToMethod · 0.95
WriteToMethod · 0.45

Tested by 1

TestWitnessHashFunction · 0.76