all: change chain head markers from block to header (#26777)
This commit is contained in:
+8
-8
@@ -152,13 +152,13 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
// * the last snap sync is not finished while user specifies a full sync this
|
||||
// time. But we don't have any recent state for full sync.
|
||||
// In these cases however it's safe to reenable snap sync.
|
||||
fullBlock, fastBlock := h.chain.CurrentBlock(), h.chain.CurrentFastBlock()
|
||||
if fullBlock.NumberU64() == 0 && fastBlock.NumberU64() > 0 {
|
||||
fullBlock, snapBlock := h.chain.CurrentBlock(), h.chain.CurrentSnapBlock()
|
||||
if fullBlock.Number.Uint64() == 0 && snapBlock.Number.Uint64() > 0 {
|
||||
h.snapSync = uint32(1)
|
||||
log.Warn("Switch sync mode from full sync to snap sync")
|
||||
}
|
||||
} else {
|
||||
if h.chain.CurrentBlock().NumberU64() > 0 {
|
||||
if h.chain.CurrentBlock().Number.Uint64() > 0 {
|
||||
// Print warning log if database is not empty to run snap sync.
|
||||
log.Warn("Switch sync mode from snap sync to full sync")
|
||||
} else {
|
||||
@@ -183,10 +183,10 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
// If we've successfully finished a sync cycle and passed any required
|
||||
// checkpoint, enable accepting transactions from the network
|
||||
head := h.chain.CurrentBlock()
|
||||
if head.NumberU64() >= h.checkpointNumber {
|
||||
if head.Number.Uint64() >= h.checkpointNumber {
|
||||
// Checkpoint passed, sanity check the timestamp to have a fallback mechanism
|
||||
// for non-checkpointed (number = 0) private networks.
|
||||
if head.Time() >= uint64(time.Now().AddDate(0, -1, 0).Unix()) {
|
||||
if head.Time >= uint64(time.Now().AddDate(0, -1, 0).Unix()) {
|
||||
atomic.StoreUint32(&h.acceptTxs, 1)
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
log.Info("Chain post-merge, sync via beacon client")
|
||||
} else {
|
||||
head := h.chain.CurrentBlock()
|
||||
if td := h.chain.GetTd(head.Hash(), head.NumberU64()); td.Cmp(ttd) >= 0 {
|
||||
if td := h.chain.GetTd(head.Hash(), head.Number.Uint64()); td.Cmp(ttd) >= 0 {
|
||||
log.Info("Chain post-TTD, sync via beacon client")
|
||||
} else {
|
||||
log.Warn("Chain pre-merge, sync via PoW (ensure beacon client is ready)")
|
||||
@@ -227,7 +227,7 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
return h.chain.Engine().VerifyHeader(h.chain, header, true)
|
||||
}
|
||||
heighter := func() uint64 {
|
||||
return h.chain.CurrentBlock().NumberU64()
|
||||
return h.chain.CurrentBlock().Number.Uint64()
|
||||
}
|
||||
inserter := func(blocks types.Blocks) (int, error) {
|
||||
// All the block fetcher activities should be disabled
|
||||
@@ -250,7 +250,7 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
// the propagated block if the head is too old. Unfortunately there is a corner
|
||||
// case when starting new networks, where the genesis might be ancient (0 unix)
|
||||
// which would prevent full nodes from accepting it.
|
||||
if h.chain.CurrentBlock().NumberU64() < h.checkpointNumber {
|
||||
if h.chain.CurrentBlock().Number.Uint64() < h.checkpointNumber {
|
||||
log.Warn("Unsynced yet, discarded propagated block", "number", blocks[0].Number(), "hash", blocks[0].Hash())
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user