Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SetHead from API and Core #1032

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading