Skip to content

Commit

Permalink
Remove SetHead from API and Core
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Aug 2, 2023
1 parent 4d43f8f commit 1df6211
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 25 deletions.
5 changes: 0 additions & 5 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,6 @@ func (c *Core) Snapshots() *snapshot.Tree {
return nil
}

// this needs to be implemented, it is being used by a lot of modules
func (c *Core) SetHead(number uint64) error {
return nil
}

func (c *Core) TxLookupLimit() uint64 {
return 0
}
Expand Down
5 changes: 0 additions & 5 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ func (b *QuaiAPIBackend) CalcOrder(header *types.Header) (*big.Int, int, error)
return b.eth.core.CalcOrder(header)
}

func (b *QuaiAPIBackend) SetHead(number uint64) {
b.eth.handler.downloader.Cancel()
b.eth.core.SetHead(number)
}

func (b *QuaiAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
// Pending block is only known by the miner
if number == rpc.PendingBlockNumber {
Expand Down
11 changes: 2 additions & 9 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Quai, error) {
if err != nil {
return nil, err
}
chainConfig, genesisHash, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, config.Genesis)
if _, ok := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !ok {
chainConfig, _, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, config.Genesis)
if genesisErr != nil {
return nil, genesisErr
}

Expand Down Expand Up @@ -181,13 +181,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Quai, error) {
}
)

// Rewind the chain in case of an incompatible config upgrade.
if compat, ok := genesisErr.(*params.ConfigCompatError); ok {
log.Warn("Rewinding chain to upgrade configuration", "err", compat)
eth.core.SetHead(compat.RewindTo)
rawdb.WriteChainConfig(chainDb, genesisHash, chainConfig)
}

if config.TxPool.Journal != "" {
config.TxPool.Journal = stack.ResolvePath(config.TxPool.Journal)
}
Expand Down
5 changes: 0 additions & 5 deletions internal/quaiapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1518,11 +1518,6 @@ func (api *PrivateDebugAPI) ChaindbCompact() error {
return nil
}

// SetHead rewinds the head of the blockchain to a previous block.
func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64) {
api.b.SetHead(uint64(number))
}

// PublicNetAPI offers network related RPC methods
type PublicNetAPI struct {
net *p2p.Server
Expand Down
1 change: 0 additions & 1 deletion internal/quaiapi/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type Backend interface {
RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs

// Blockchain API
SetHead(number uint64)
HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error)
Expand Down

0 comments on commit 1df6211

Please sign in to comment.