Add missing error logs #171
@ -37,6 +37,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/eth/filters"
|
"github.com/ethereum/go-ethereum/eth/filters"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
@ -1096,11 +1097,13 @@ func (pea *PublicEthAPI) writeStateDiffFor(blockHash common.Hash) {
|
|||||||
func (pea *PublicEthAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
|
func (pea *PublicEthAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
|
||||||
fields, err := RPCMarshalBlock(b, inclTx, fullTx)
|
fields, err := RPCMarshalBlock(b, inclTx, fullTx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error RPC marshalling block with hash", b.Hash().String(), err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if inclTx {
|
if inclTx {
|
||||||
td, err := pea.B.GetTd(b.Hash())
|
td, err := pea.B.GetTd(b.Hash())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error getting td for block with hash", b.Hash().String(), err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
fields["totalDifficulty"] = (*hexutil.Big)(td)
|
fields["totalDifficulty"] = (*hexutil.Big)(td)
|
||||||
|
@ -342,6 +342,7 @@ func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber
|
|||||||
var headerIPLD models.IPLDModel
|
var headerIPLD models.IPLDModel
|
||||||
headerIPLD, err = b.Fetcher.FetchHeader(tx, headerCID)
|
headerIPLD, err = b.Fetcher.FetchHeader(tx, headerCID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching header ipld", err)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -352,10 +353,12 @@ func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch and decode the uncle IPLDs
|
// Fetch and decode the uncle IPLDs
|
||||||
var uncleIPLDs []models.IPLDModel
|
var uncleIPLDs []models.IPLDModel
|
||||||
uncleIPLDs, err = b.Fetcher.FetchUncles(tx, uncleCIDs)
|
uncleIPLDs, err = b.Fetcher.FetchUncles(tx, uncleCIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching uncle iplds", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var uncles []*types.Header
|
var uncles []*types.Header
|
||||||
@ -367,10 +370,12 @@ func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber
|
|||||||
}
|
}
|
||||||
uncles = append(uncles, &uncle)
|
uncles = append(uncles, &uncle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch and decode the transaction IPLDs
|
// Fetch and decode the transaction IPLDs
|
||||||
var txIPLDs []models.IPLDModel
|
var txIPLDs []models.IPLDModel
|
||||||
txIPLDs, err = b.Fetcher.FetchTrxs(tx, txCIDs)
|
txIPLDs, err = b.Fetcher.FetchTrxs(tx, txCIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching tx iplds", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var transactions []*types.Transaction
|
var transactions []*types.Transaction
|
||||||
@ -386,6 +391,7 @@ func (b *Backend) BlockByNumber(ctx context.Context, blockNumber rpc.BlockNumber
|
|||||||
var rctIPLDs []models.IPLDModel
|
var rctIPLDs []models.IPLDModel
|
||||||
rctIPLDs, err = b.Fetcher.FetchRcts(tx, rctCIDs)
|
rctIPLDs, err = b.Fetcher.FetchRcts(tx, rctCIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching rct iplds", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var receipts []*types.Receipt
|
var receipts []*types.Receipt
|
||||||
@ -438,6 +444,7 @@ func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Blo
|
|||||||
var headerIPLD models.IPLDModel
|
var headerIPLD models.IPLDModel
|
||||||
headerIPLD, err = b.Fetcher.FetchHeader(tx, headerCID)
|
headerIPLD, err = b.Fetcher.FetchHeader(tx, headerCID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching header ipld", err)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -452,6 +459,7 @@ func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Blo
|
|||||||
var uncleIPLDs []models.IPLDModel
|
var uncleIPLDs []models.IPLDModel
|
||||||
uncleIPLDs, err = b.Fetcher.FetchUncles(tx, uncleCIDs)
|
uncleIPLDs, err = b.Fetcher.FetchUncles(tx, uncleCIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching uncle iplds", err)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -470,6 +478,7 @@ func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Blo
|
|||||||
var txIPLDs []models.IPLDModel
|
var txIPLDs []models.IPLDModel
|
||||||
txIPLDs, err = b.Fetcher.FetchTrxs(tx, txCIDs)
|
txIPLDs, err = b.Fetcher.FetchTrxs(tx, txCIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching tx iplds", err)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -488,6 +497,7 @@ func (b *Backend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Blo
|
|||||||
var rctIPLDs []models.IPLDModel
|
var rctIPLDs []models.IPLDModel
|
||||||
rctIPLDs, err = b.Fetcher.FetchRcts(tx, rctCIDs)
|
rctIPLDs, err = b.Fetcher.FetchRcts(tx, rctCIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("error fetching rct iplds", err)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user