Skip to content
Merged
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
6 changes: 3 additions & 3 deletions core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1226,15 +1226,15 @@ 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)
if header == nil {
return false, nil
}

if header.Difficulty.Cmp(common.Big0) == 0 {
if header.Difficulty.Sign() == 0 {
return true, nil
}

Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion turbo/jsonrpc/trace_filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down