mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Fix EOF error in gRPC state-sync (#489)
* Fix EOF error in gRPC state-sync * linters Co-authored-by: Evgeny Danienko <6655321@bk.ru>
This commit is contained in:
parent
1d1f00cbe7
commit
72aa44efe6
1 changed files with 9 additions and 5 deletions
|
|
@ -2,11 +2,13 @@ package heimdallgrpc
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
proto "github.com/maticnetwork/polyproto/heimdall"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/clerk"
|
||||
|
||||
proto "github.com/maticnetwork/polyproto/heimdall"
|
||||
)
|
||||
|
||||
func (h *HeimdallGRPCClient) StateSyncEvents(ctx context.Context, fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) {
|
||||
|
|
@ -31,8 +33,12 @@ func (h *HeimdallGRPCClient) StateSyncEvents(ctx context.Context, fromID uint64,
|
|||
|
||||
for {
|
||||
events, err = res.Recv()
|
||||
if errors.Is(err, io.EOF) {
|
||||
return eventRecords, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
break
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, event := range events.Result {
|
||||
|
|
@ -50,6 +56,4 @@ func (h *HeimdallGRPCClient) StateSyncEvents(ctx context.Context, fromID uint64,
|
|||
eventRecords = append(eventRecords, eventRecord)
|
||||
}
|
||||
}
|
||||
|
||||
return eventRecords, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue