Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka committed Aug 30, 2023
1 parent b9455c7 commit a24e6c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions ethmonitor/ethmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ func (m *Monitor) fetchBlockByHash(ctx context.Context, hash common.Hash) (*type
maxNotFoundAttempts, notFoundAttempts := 2, 0 // waiting for node to sync
maxErrAttempts, errAttempts := 2, 0 // quick retry in case of short-term node connection failures

// var block *types.Block
var blockPayload []byte
var err error

Expand Down Expand Up @@ -684,7 +683,7 @@ func (m *Monitor) fetchBlockByHash(ctx context.Context, hash common.Hash) (*type
continue
}
}
if blockPayload != nil {
if len(blockPayload) > 0 {
return blockPayload, nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions ethrpc/ethrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (p *Provider) RawBlockByHash(ctx context.Context, hash common.Hash) ([]byte
if err != nil {
return nil, err
}
if result == nil || string(result) == "null" {
if len(result) == 0 || string(result) == "null" {
return nil, ethereum.NotFound
}
return result, nil
Expand All @@ -217,7 +217,7 @@ func (p *Provider) RawBlockByNumber(ctx context.Context, blockNum *big.Int) ([]b
if err != nil {
return nil, err
}
if result == nil || string(result) == "null" {
if len(result) == 0 || string(result) == "null" {
return nil, ethereum.NotFound
}
return result, nil
Expand Down

0 comments on commit a24e6c3

Please sign in to comment.