Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopeereboom committed Jun 12, 2024
1 parent 4a85ab2 commit 1e851c3
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions database/tbcd/level/level_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ func bytes2Header(header []byte) (*wire.BlockHeader, error) {
return &bh, nil
}

func h2b80(wbh *wire.BlockHeader) (b [80]byte) {
w := bytes.NewBuffer(b[:])
err := wbh.Serialize(w)
if err != nil {
panic(err)
}
return
}

func h2b(wbh *wire.BlockHeader) []byte {
hb, err := header2Bytes(wbh)
if err != nil {
Expand Down Expand Up @@ -91,9 +82,10 @@ func TestEncodeDecodeBlockHeader(t *testing.T) {
Header: h2b(&genesisBH),
Difficulty: *difficulty,
}
er := encodeBlockHeader(bh.Height, h2b80(&genesisBH), &bh.Difficulty)
er := encodeBlockHeader(bh.Height, [80]byte(h2b(&genesisBH)), &bh.Difficulty)
dr := decodeBlockHeader(er[:])
if diff := deep.Equal(bh, *dr); len(diff) > 0 {
t.Fatalf("unexpected diff: %v%v", spew.Sdump(bh), spew.Sdump(dr))
t.Errorf("unexpected diff: %s", diff)
}
}
Expand Down

0 comments on commit 1e851c3

Please sign in to comment.