MCPcopy Create free account
hub / github.com/chain/Core / ReadFrom

Method ReadFrom

protocol/bc/hash.go:110–118  ·  view source on GitHub ↗

ReadFrom satisfies the io.ReaderFrom interface.

(r io.Reader)

Source from the content-addressed store, hash-verified

108
109// ReadFrom satisfies the io.ReaderFrom interface.
110func (h *Hash) ReadFrom(r io.Reader) (int64, error) {
111 var b32 [32]byte
112 n, err := io.ReadFull(r, b32[:])
113 if err != nil {
114 return int64(n), err
115 }
116 *h = NewHash(b32)
117 return int64(n), nil
118}
119
120// IsZero tells whether a Hash pointer is nil or points to an all-zero
121// hash.

Callers 15

NewTxVMContextFunction · 0.95
ContainsMethod · 0.95
InsertMethod · 0.95
calcHashMethod · 0.95
benchmarkStoreSnapshotFunction · 0.95
SigHashMethod · 0.45
EntryIDFunction · 0.45
MerkleRootFunction · 0.45
AssetDefinitionHashMethod · 0.45
readFromMethod · 0.45
readFromMethod · 0.45
readFromMethod · 0.45

Calls 1

NewHashFunction · 0.85

Tested by 2

benchmarkStoreSnapshotFunction · 0.76
randHashFunction · 0.36