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

Function TestBlockHeaderHash

protocol/bc/blockheader_test.go:27–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestBlockHeaderHash(t *testing.T) {
28 cases := []struct {
29 h *BlockHeader
30 want Hash
31 }{{
32 h: &BlockHeader{
33 NextPredicate: &Predicate{
34 Version: 1,
35 },
36 },
37 want: mustDecodeHash("d1ae2bb8f50558a859a8578aa8c419257f0e2d2d19b89d8e07b716ceab7df443"),
38 }, {
39 h: filledBlock,
40 want: mustDecodeHash("5eb5b8cbd3e41b767a6447d5cb4adc2a255eb3fad37b1e2279b5ddb5f64c41af"),
41 }}
42
43 for _, c := range cases {
44 got := c.h.Hash()
45 if got != c.want {
46 t.Errorf("Hash(%v) = %x want %x", c.h, got.Bytes(), c.want.Bytes())
47 }
48 }
49}
50
51func TestBlockHeaderScanValue(t *testing.T) {
52 filledBytes := mustDecodeHex("080310011a0909000000000000000120e80728d0860330013a0909000000000000000242090900000000000000034a090900000000000000045246080110011a4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")

Callers

nothing calls this directly

Calls 3

mustDecodeHashFunction · 0.70
HashMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected