From 428bc18abd1720bed6fe8708e8a9f8add3cc9f27 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Wed, 12 Feb 2025 18:09:13 +0100 Subject: [PATCH] TestBlockBody --- core/types/block_ext_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/types/block_ext_test.go b/core/types/block_ext_test.go index 14f6d04588..b0ea2cef99 100644 --- a/core/types/block_ext_test.go +++ b/core/types/block_ext_test.go @@ -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) +}