mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
fix: pbv2 condition (#12812)
This commit is contained in:
committed by
Preston Van Loon
parent
cd340cb0c8
commit
b335eba625
@@ -61,7 +61,7 @@ func (a *data) PbV2() (*enginev1.PayloadAttributesV2, error) {
|
|||||||
if a == nil {
|
if a == nil {
|
||||||
return nil, errNilPayloadAttribute
|
return nil, errNilPayloadAttribute
|
||||||
}
|
}
|
||||||
if a.version < version.Capella {
|
if a.version != version.Capella {
|
||||||
return nil, consensus_types.ErrNotSupported("PbV2", a.version)
|
return nil, consensus_types.ErrNotSupported("PbV2", a.version)
|
||||||
}
|
}
|
||||||
if a.timeStamp == 0 && len(a.prevRandao) == 0 {
|
if a.timeStamp == 0 && len(a.prevRandao) == 0 {
|
||||||
|
|||||||
@@ -182,6 +182,22 @@ func TestPayloadAttributeGetters(t *testing.T) {
|
|||||||
require.Equal(t, (*enginev1.PayloadAttributesV3)(nil), got)
|
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 {
|
for _, test := range tests {
|
||||||
|
|||||||
Reference in New Issue
Block a user