MCPcopy
hub / github.com/canopy-network/canopy / GetHash

Method GetHash

lib/tx.go:134–144  ·  view source on GitHub ↗

GetHash() returns the cryptographic hash of the Transaction

()

Source from the content-addressed store, hash-verified

132
133// GetHash() returns the cryptographic hash of the Transaction
134func (x *Transaction) GetHash() ([]byte, ErrorI) {
135 // convert the transaction into proto bytes
136 protoBytes, err := Marshal(x)
137 // if an error occurred during the conversion
138 if err != nil {
139 // exit with error
140 return nil, err
141 }
142 // exit with the hash of the proto bytes
143 return crypto.Hash(protoBytes), nil
144}
145
146// GetSig() accessor for signature field (do not delete: needed to satisfy TransactionI)
147func (x *Transaction) GetSig() SignatureI { return x.Signature }

Callers 1

TestGetHashFunction · 0.95

Calls 2

HashFunction · 0.92
MarshalFunction · 0.70

Tested by 1

TestGetHashFunction · 0.76