mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 16:08:26 -05:00
isCanonical for slot 0 should return true (#8269)
Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
@@ -859,6 +859,10 @@ func (bs *Server) GetIndividualVotes(
|
||||
// if the input slot has a skip block, false is returned,
|
||||
// if the input slot has more than one block, an error is returned.
|
||||
func (bs *Server) isSlotCanonical(ctx context.Context, slot uint64) (bool, error) {
|
||||
if slot == 0 {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
hasBlockRoots, roots, err := bs.BeaconDB.BlockRootsBySlot(ctx, slot)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
@@ -2142,3 +2142,11 @@ func TestServer_isSlotCanonical(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestServer_isSlotCanonicalForSlot0(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
bs := &Server{}
|
||||
c, err := bs.isSlotCanonical(ctx, 0)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user