good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 7b8d828a authored by Andrew Ashikhmin's avatar Andrew Ashikhmin Committed by GitHub
Browse files

RPC: return latest available block rather than forkchoice head (#3888)

parent 777412e0
No related branches found
No related tags found
No related merge requests found
...@@ -4,8 +4,6 @@ import ( ...@@ -4,8 +4,6 @@ import (
"fmt" "fmt"
"github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/eth/stagedsync/stages" "github.com/ledgerwatch/erigon/eth/stagedsync/stages"
"github.com/ledgerwatch/erigon/rpc" "github.com/ledgerwatch/erigon/rpc"
) )
...@@ -28,14 +26,6 @@ func getBlockNumber(number rpc.BlockNumber, tx kv.Tx) (uint64, error) { ...@@ -28,14 +26,6 @@ func getBlockNumber(number rpc.BlockNumber, tx kv.Tx) (uint64, error) {
} }
func getLatestBlockNumber(tx kv.Tx) (uint64, error) { func getLatestBlockNumber(tx kv.Tx) (uint64, error) {
forkchoiceHeadHash := rawdb.ReadForkchoiceHead(tx)
if forkchoiceHeadHash != (common.Hash{}) {
forkchoiceHeadNum := rawdb.ReadHeaderNumber(tx, forkchoiceHeadHash)
if forkchoiceHeadNum != nil {
return *forkchoiceHeadNum, nil
}
}
blockNum, err := stages.GetStageProgress(tx, stages.Execution) blockNum, err := stages.GetStageProgress(tx, stages.Execution)
if err != nil { if err != nil {
return 0, fmt.Errorf("getting latest block number: %w", err) return 0, fmt.Errorf("getting latest block number: %w", err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment