Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 3c0b9e4

Browse files
committed
TestBlockBody
1 parent 3c3ee20 commit 3c0b9e4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

core/types/block_ext_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,29 @@ func fieldsAreDeepCopied(t *testing.T, original, cpy any) {
186186
assert.NotEqualf(t, originalField, cpyField.Interface(), "field %q", fieldName)
187187
}
188188
}
189+
190+
func TestBlockBody(t *testing.T) {
191+
t.Parallel()
192+
193+
testTx := NewTransaction(0, common.Address{1}, big.NewInt(2), 3, big.NewInt(4), []byte{5})
194+
195+
block := &Block{
196+
transactions: []*Transaction{testTx},
197+
uncles: []*Header{{ParentHash: common.Hash{6}}},
198+
version: 7,
199+
extdata: ptrTo([]byte{8}),
200+
}
201+
202+
wantBody := &Body{
203+
Transactions: []*Transaction{testTx},
204+
Uncles: []*Header{{ParentHash: common.Hash{6}}},
205+
}
206+
wantExtra := &BodyExtra{
207+
Version: 7,
208+
ExtData: ptrTo([]byte{8}),
209+
}
210+
_ = WithBodyExtra(wantBody, wantExtra)
211+
212+
body := block.Body()
213+
assert.Equal(t, wantBody, body)
214+
}

0 commit comments

Comments
 (0)