mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
fix: pbv2 condition (#12812)
This commit is contained in:
parent
cd340cb0c8
commit
b335eba625
@ -61,7 +61,7 @@ func (a *data) PbV2() (*enginev1.PayloadAttributesV2, error) {
|
||||
if a == nil {
|
||||
return nil, errNilPayloadAttribute
|
||||
}
|
||||
if a.version < version.Capella {
|
||||
if a.version != version.Capella {
|
||||
return nil, consensus_types.ErrNotSupported("PbV2", a.version)
|
||||
}
|
||||
if a.timeStamp == 0 && len(a.prevRandao) == 0 {
|
||||
|
@ -182,6 +182,22 @@ func TestPayloadAttributeGetters(t *testing.T) {
|
||||
require.Equal(t, (*enginev1.PayloadAttributesV3)(nil), got)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Get PbDeneb on pbv2 will fail",
|
||||
tc: func(t *testing.T) {
|
||||
p := &enginev1.PayloadAttributesV3{
|
||||
Timestamp: 1,
|
||||
PrevRandao: []byte{1, 2, 3},
|
||||
SuggestedFeeRecipient: []byte{4, 5, 6},
|
||||
Withdrawals: []*enginev1.Withdrawal{{Index: 1}, {Index: 2}, {Index: 3}},
|
||||
ParentBeaconBlockRoot: []byte{'a'},
|
||||
}
|
||||
a, err := New(p)
|
||||
require.NoError(t, err)
|
||||
_, err = a.PbV2()
|
||||
require.ErrorContains(t, "PbV2 is not supported for deneb", err)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user