X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=database%2Fstore_test.go;fp=database%2Fstore_test.go;h=3686838d917c1e41caf825dd3ac80905f511d72e;hb=e2faecd00b2a6bd0a2064a805a14c042d8084e4f;hp=e9ec0fbb8aedb85768bbd49ab7a9ead20de63eb7;hpb=e52b2fa52e40382de27e9293895dfe72a6b9e8fc;p=bytom%2Fvapor.git diff --git a/database/store_test.go b/database/store_test.go index e9ec0fbb..3686838d 100644 --- a/database/store_test.go +++ b/database/store_test.go @@ -207,9 +207,8 @@ func TestSaveBlock(t *testing.T) { t.Errorf("case %v: VerifyStatus mismatch: have %x, want %x", i, gotStatus.VerifyStatus, c.txStatus.VerifyStatus) } - data := store.db.Get(calcBlockHeaderKey(&blockHash)) - gotBlockHeader := new(types.BlockHeader) - if err := gotBlockHeader.UnmarshalText(data); err != nil { + gotBlockHeader, err := store.GetBlockHeader(&blockHash) + if err != nil { t.Fatal(err) } @@ -266,9 +265,9 @@ func TestSaveBlockHeader(t *testing.T) { BlockWitness: types.BlockWitness{ Witness: [][]byte{ []byte{0x3e, 0x94, 0x5d, 0x35}, - []byte{0x3e, 0x94, 0x5d, 0x35}, - []byte{0x3e, 0x94, 0x5d, 0x35}, - []byte{0xd4, 0x3b, 0x3d, 0xe3}, + []byte{0xdd, 0x80, 0x67, 0x29}, + []byte{0xff, 0xff, 0xff, 0xff}, + []byte{0x00, 0x01, 0x02, 0x03}, }, }, }, @@ -281,14 +280,13 @@ func TestSaveBlockHeader(t *testing.T) { } blockHash := c.blockHeader.Hash() - gotBlockHeaderData := store.db.Get(calcBlockHeaderKey(&blockHash)) - binaryBlockHeader, err := c.blockHeader.MarshalText() + gotBlockHeader, err := store.GetBlockHeader(&blockHash) if err != nil { t.Fatal(err) } - if !testutil.DeepEqual(gotBlockHeaderData, binaryBlockHeader) { - t.Errorf("case %v: block header mismatch: have %x, want %x", i, gotBlockHeaderData, binaryBlockHeader) + if !testutil.DeepEqual(gotBlockHeader, c.blockHeader) { + t.Errorf("case %v: block header mismatch: have %x, want %x", i, gotBlockHeader, c.blockHeader) } } }