Unverified Commit 1e973a96 authored by Martin Holst Swende's avatar Martin Holst Swende Committed by GitHub

eth: clarify the error string on getlogs failure (#24617)

This PR makes the errors we spit out a bit more clear about what block is problematic.
parent 3fd16af5
...@@ -19,6 +19,7 @@ package eth ...@@ -19,6 +19,7 @@ package eth
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"math/big" "math/big"
"time" "time"
...@@ -185,11 +186,11 @@ func (b *EthAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*typ ...@@ -185,11 +186,11 @@ func (b *EthAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*typ
db := b.eth.ChainDb() db := b.eth.ChainDb()
number := rawdb.ReadHeaderNumber(db, hash) number := rawdb.ReadHeaderNumber(db, hash)
if number == nil { if number == nil {
return nil, errors.New("failed to get block number from hash") return nil, fmt.Errorf("failed to get block number for hash %#x", hash)
} }
logs := rawdb.ReadLogs(db, hash, *number, b.eth.blockchain.Config()) logs := rawdb.ReadLogs(db, hash, *number, b.eth.blockchain.Config())
if logs == nil { if logs == nil {
return nil, errors.New("failed to get logs for block") return nil, fmt.Errorf("failed to get logs for block #%d (0x%s)", *number, hash.TerminalString())
} }
return logs, nil return logs, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment