Add log while serving getBlockByNumber (#176)

* Add log while serving getBlockByNumber

* Update GQL API to return empty result when header not found for hash
This commit was merged in pull request #176.
This commit is contained in:
prathamesh0
2022-07-15 16:19:31 +05:30
committed by GitHub
parent 6cb54ca790
commit b90c28906a
3 changed files with 11 additions and 7 deletions
+6 -3
View File
@@ -23,6 +23,7 @@ import (
"database/sql"
"errors"
"fmt"
"strings"
"time"
"github.com/ethereum/go-ethereum/common"
@@ -1268,10 +1269,12 @@ func (r *Resolver) AllEthHeaderCids(ctx context.Context, args struct {
if args.Condition.BlockHash != nil {
headerCID, err := r.backend.Retriever.RetrieveHeaderAndTxCIDsByBlockHash(common.HexToHash(*args.Condition.BlockHash))
if err != nil {
return nil, err
if !strings.Contains(err.Error(), "not found") {
return nil, err
}
} else {
headerCIDs = append(headerCIDs, headerCID)
}
headerCIDs = append(headerCIDs, headerCID)
} else if args.Condition.BlockNumber != nil {
headerCIDs, err = r.backend.Retriever.RetrieveHeaderAndTxCIDsByBlockNumber(args.Condition.BlockNumber.ToInt().Int64())
if err != nil {