Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions consensus-types/payload-attribute/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func (a *data) PbV3() (*enginev1.PayloadAttributesV3, error) {
if a.version != version.Deneb {
return nil, consensus_types.ErrNotSupported("PbV3", a.version)
}
if a.timeStamp == 0 && len(a.prevRandao) == 0 && len(a.parentBeaconBlockRoot) == 0 {
return nil, nil
}
return &enginev1.PayloadAttributesV3{
Timestamp: a.timeStamp,
PrevRandao: a.prevRandao,
Expand Down
10 changes: 10 additions & 0 deletions consensus-types/payload-attribute/getters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ func TestPayloadAttributeGetters(t *testing.T) {
require.ErrorContains(t, "PbV3 is not supported for capella: unsupported getter", err)
},
},
{
name: "Get PbDeneb (nil)",
tc: func(t *testing.T) {
a, err := New(&enginev1.PayloadAttributesV3{})
require.NoError(t, err)
got, err := a.PbV3()
require.NoError(t, err)
require.Equal(t, (*enginev1.PayloadAttributesV3)(nil), got)
},
},
}

for _, test := range tests {
Expand Down