bnb-chain / greenfield-storage-provider

Greenfield Storage Provider is a storage infrastructure for Greenfield decentralized storage platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ BlockSyncer ] Failed to get block from map

julia-light opened this issue · comments

commented

Run command:

./gnfd-sp --config   /path-to-config/config.toml

Error Log:

{"t":"2023-06-21T07:40:26.523Z","l":"error","caller":"parser/worker.go:86","msg":"error while process block","height":1,"err":"failed to get block from map need retry"} 
{"t":"2023-06-21T07:40:29.530Z","l":"warn","caller":"blocksyncer/blocksyncer_indexer.go:89","msg":"failed to get map data height: 1"} 
{"t":"2023-06-21T07:40:29.530Z","l":"info","caller":"parser/worker.go:121","msg":"processing block","height":1} 
{"t":"2023-06-21T07:40:29.530Z","l":"error","caller":"parser/worker.go:86","msg":"error while process block","height":1,"err":"failed to get block from map need retry"}

nfhxvK0CGx

How to Fix?

diff --git a/modular/blocksyncer/blocksyncer_indexer.go b/modular/blocksyncer/blocksyncer_indexer.go
index a60e723..d93655b 100644
--- a/modular/blocksyncer/blocksyncer_indexer.go
+++ b/modular/blocksyncer/blocksyncer_indexer.go
@@ -78,7 +78,7 @@ func (i *Impl) Process(height uint64) error {
        flagAny := i.GetCatchUpFlag().Load()
        flag := flagAny.(int64)
        heightKey := fmt.Sprintf("%s-%d", i.GetServiceName(), height)
-       if flag == -1 || flag >= int64(height) {
+       if flag < -1 || flag > int64(height) {
                blockAny, okb := blockMap.Load(heightKey)
                eventsAny, oke := eventMap.Load(heightKey)
                txsAny, okt := txMap.Load(heightKey)
make build