diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index b5603c81129..573f1ce6bd1 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -1226,7 +1226,7 @@ func Transitioned(db kv.Getter, blockNum uint64, terminalTotalDifficulty *big.In return false, nil } - if terminalTotalDifficulty.Cmp(common.Big0) == 0 { + if terminalTotalDifficulty.Sign() == 0 { return true, nil } header := ReadHeaderByNumber(db, blockNum) @@ -1234,7 +1234,7 @@ func Transitioned(db kv.Getter, blockNum uint64, terminalTotalDifficulty *big.In return false, nil } - if header.Difficulty.Cmp(common.Big0) == 0 { + if header.Difficulty.Sign() == 0 { return true, nil } @@ -1256,7 +1256,7 @@ func IsPosBlock(db kv.Getter, blockHash common.Hash) (trans bool, err error) { return false, nil } - return header.Difficulty.Cmp(common.Big0) == 0, nil + return header.Difficulty.Sign() == 0, nil } var SnapshotsKey = []byte("snapshots") diff --git a/eth/backend.go b/eth/backend.go index 7fb0a7f9d32..2cd74fa4ab9 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -238,7 +238,7 @@ const blockBufferSize = 128 // initialisation of the common Ethereum object) func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethereum, error) { config.Snapshot.Enabled = config.Sync.UseSnapshots - if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(libcommon.Big0) <= 0 { + if config.Miner.GasPrice == nil || config.Miner.GasPrice.Sign() <= 0 { logger.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice) config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice) } diff --git a/turbo/engineapi/engine_block_downloader/block_downloader.go b/turbo/engineapi/engine_block_downloader/block_downloader.go index db2b2e29f37..50283851ffc 100644 --- a/turbo/engineapi/engine_block_downloader/block_downloader.go +++ b/turbo/engineapi/engine_block_downloader/block_downloader.go @@ -193,7 +193,7 @@ func (e *EngineBlockDownloader) loadDownloadedHeaders(tx kv.RwTx) (fromBlock uin return saveHeader(tx, &h, h.Hash()) } - foundPow = h.Difficulty.Cmp(libcommon.Big0) != 0 + foundPow = h.Difficulty.Sign() != 0 if foundPow { if (fromHash == libcommon.Hash{}) { fromHash = h.Hash() diff --git a/turbo/jsonrpc/trace_filtering.go b/turbo/jsonrpc/trace_filtering.go index c60674140ac..36e37229de1 100644 --- a/turbo/jsonrpc/trace_filtering.go +++ b/turbo/jsonrpc/trace_filtering.go @@ -425,7 +425,7 @@ func (api *TraceAPIImpl) filterV3(ctx context.Context, dbtx kv.TemporalTx, fromB if !isPos && chainConfig.TerminalTotalDifficulty != nil { header := lastHeader - isPos = header.Difficulty.Cmp(common.Big0) == 0 || header.Difficulty.Cmp(chainConfig.TerminalTotalDifficulty) >= 0 + isPos = header.Difficulty.Sign() == 0 || header.Difficulty.Cmp(chainConfig.TerminalTotalDifficulty) >= 0 } lastBlockHash = lastHeader.Hash()