Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Aug 3, 2023
1 parent db4cb02 commit d9f67ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions handlers/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,14 @@ func buildSlotPageData(blockSlot int64, blockRoot []byte) (*models.SlotPageData,
}
}

if blockData == nil {
var slot uint64
if blockData != nil {
slot = uint64(blockData.Header.Data.Header.Message.Slot)
} else if blockSlot > -1 {
slot = uint64(blockSlot)
} else {
return nil, -1
}
slot := uint64(blockData.Header.Data.Header.Message.Slot)
logrus.Printf("slot page called: %v", slot)

pageData := &models.SlotPageData{
Expand Down
6 changes: 4 additions & 2 deletions services/beaconservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ func (bs *BeaconService) GetDbEpochs(firstEpoch uint64, limit uint32) []*dbtypes
idxHeadEpoch = utils.EpochOfSlot(bs.indexer.GetHeadSlot())
}

lastEpoch := firstEpoch - uint64(limit)
lastEpoch := int64(firstEpoch) - int64(limit)
if lastEpoch < 0 {
lastEpoch = 0
}
for epochIdx := int64(firstEpoch); epochIdx >= int64(lastEpoch) && resIdx < int(limit); epochIdx-- {
for epochIdx := int64(firstEpoch); epochIdx >= lastEpoch && resIdx < int(limit); epochIdx-- {
epoch := uint64(epochIdx)
var resEpoch *dbtypes.Epoch
if dbIdx < dbCnt && dbEpochs[dbIdx].Epoch == epoch {
Expand Down Expand Up @@ -340,6 +340,7 @@ func (bs *BeaconService) GetDbBlocks(firstSlot uint64, limit int32, withOrphaned
}
}
}
slot--
}

if resIdx < int(limit) {
Expand Down Expand Up @@ -388,6 +389,7 @@ func (bs *BeaconService) GetDbBlocksForSlots(firstSlot uint64, slotLimit uint32,
}
}
}
slot--
}

if slot > lastSlot {
Expand Down
4 changes: 2 additions & 2 deletions test-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Chain network configuration
chain:
#name: "mainnet"
genesisTimestamp: 1690484700
genesisValidatorsRoot: "0xbf3c3d4683a5a4d286cd2a5ef7a5c1702f649eee82cdc7e87e05030102d12ccf"
#genesisTimestamp: 1690484700
#genesisValidatorsRoot: "0xbf3c3d4683a5a4d286cd2a5ef7a5c1702f649eee82cdc7e87e05030102d12ccf"
configPath: "config.yaml"
#genesisTimestamp: 1688126460
#configPath: "config-devnet7.yaml"
Expand Down

0 comments on commit d9f67ec

Please sign in to comment.