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

Method Scan

protocol/bc/hash.go:96–108  ·  view source on GitHub ↗

Scan satisfies the driver.Scanner interface

(v interface{})

Source from the content-addressed store, hash-verified

94
95// Scan satisfies the driver.Scanner interface
96func (h *Hash) Scan(v interface{}) error {
97 var buf [32]byte
98 b, ok := v.([]byte)
99 if !ok {
100 return fmt.Errorf("Hash.Scan received unsupported type %T", v)
101 }
102 if len(b) != 32 {
103 return fmt.Errorf("Hash.Scan received a bad length string %x", b)
104 }
105 copy(buf[:], b)
106 *h = NewHash(buf)
107 return nil
108}
109
110// WriteTo satisfies the io.WriterTo interface.
111func (h Hash) WriteTo(w io.Writer) (int64, error) {

Callers 4

TestHashScanFunction · 0.95
TestGoldenFunction · 0.45
TestBlockHeaderScanValueFunction · 0.45
TestBlockScanFunction · 0.45

Calls 1

NewHashFunction · 0.85

Tested by 4

TestHashScanFunction · 0.76
TestGoldenFunction · 0.36
TestBlockHeaderScanValueFunction · 0.36
TestBlockScanFunction · 0.36