Skip to content

Commit

Permalink
TestBlockBody
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Feb 12, 2025
1 parent 3c3ee20 commit 3c0b9e4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/types/block_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,29 @@ func fieldsAreDeepCopied(t *testing.T, original, cpy any) {
assert.NotEqualf(t, originalField, cpyField.Interface(), "field %q", fieldName)
}
}

func TestBlockBody(t *testing.T) {
t.Parallel()

testTx := NewTransaction(0, common.Address{1}, big.NewInt(2), 3, big.NewInt(4), []byte{5})

block := &Block{
transactions: []*Transaction{testTx},
uncles: []*Header{{ParentHash: common.Hash{6}}},
version: 7,
extdata: ptrTo([]byte{8}),
}

wantBody := &Body{
Transactions: []*Transaction{testTx},
Uncles: []*Header{{ParentHash: common.Hash{6}}},
}
wantExtra := &BodyExtra{
Version: 7,
ExtData: ptrTo([]byte{8}),
}
_ = WithBodyExtra(wantBody, wantExtra)

body := block.Body()
assert.Equal(t, wantBody, body)
}

0 comments on commit 3c0b9e4

Please sign in to comment.