mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
eth: remove usage of tdd
This commit is contained in:
parent
0aee8d9db7
commit
aa36b7dd9b
5 changed files with 23 additions and 55 deletions
|
|
@ -18,7 +18,6 @@
|
|||
package ethconfig
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
|
|
@ -238,11 +237,5 @@ func CreateConsensusEngine(chainConfig *params.ChainConfig, ethConfig *Config, d
|
|||
return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient, false), nil
|
||||
}
|
||||
}
|
||||
// If defaulting to proof-of-work, enforce an already merged network since
|
||||
// we cannot run PoW algorithms anymore, so we cannot even follow a chain
|
||||
// not coordinated by a beacon node.
|
||||
if !chainConfig.TerminalTotalDifficultyPassed {
|
||||
return nil, errors.New("ethash is only supported as a historical component of already merged networks")
|
||||
}
|
||||
return beacon.New(ethash.NewFaker()), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ func (f *BlockFetcher) loop() {
|
|||
case res := <-resCh:
|
||||
res.Done <- nil
|
||||
// Ignoring withdrawals here, since the block fetcher is not used post-merge.
|
||||
txs, uncles, _, _ := res.Res.(*eth.BlockBodiesResponse).Unpack()
|
||||
txs, uncles, _ := res.Res.(*eth.BlockBodiesResponse).Unpack()
|
||||
f.FilterBodies(peer, txs, uncles, time.Now(), announcedAt)
|
||||
|
||||
case <-timeout.C:
|
||||
|
|
|
|||
|
|
@ -203,20 +203,7 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
|||
}
|
||||
// Construct the downloader (long sync)
|
||||
h.downloader = downloader.New(config.Database, h.eventMux, h.chain, nil, h.removePeer, h.enableSyncedFeatures, config.checker)
|
||||
if ttd := h.chain.Config().TerminalTotalDifficulty; ttd != nil {
|
||||
if h.chain.Config().TerminalTotalDifficultyPassed {
|
||||
log.Info("Chain post-merge, sync via beacon client")
|
||||
} else {
|
||||
head := h.chain.CurrentBlock()
|
||||
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)")
|
||||
}
|
||||
}
|
||||
} else if h.chain.Config().TerminalTotalDifficultyPassed {
|
||||
log.Error("Chain configured post-merge, but without TTD. Are you debugging sync?")
|
||||
}
|
||||
|
||||
// Construct the fetcher (short sync)
|
||||
validator := func(header *types.Header) error {
|
||||
// Reject all the PoS style headers in the first place. No matter
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int,
|
|||
MergeNetsplitBlock: big.NewInt(0),
|
||||
ShanghaiBlock: big.NewInt(0),
|
||||
TerminalTotalDifficulty: big.NewInt(0),
|
||||
TerminalTotalDifficultyPassed: true,
|
||||
Ethash: new(params.EthashConfig),
|
||||
Bor: params.TestChainConfig.Bor,
|
||||
}
|
||||
|
|
|
|||
11
eth/sync.go
11
eth/sync.go
|
|
@ -146,17 +146,6 @@ func (cs *chainSyncer) nextSyncOp() *chainSyncOp {
|
|||
if cs.doneCh != nil {
|
||||
return nil // Sync already running
|
||||
}
|
||||
// If a beacon client once took over control, disable the entire legacy sync
|
||||
// path from here on end. Note, there is a slight "race" between reaching TTD
|
||||
// and the beacon client taking over. The downloader will enforce that nothing
|
||||
// above the first TTD will be delivered to the chain for import.
|
||||
//
|
||||
// An alternative would be to check the local chain for exceeding the TTD and
|
||||
// avoid triggering a sync in that case, but that could also miss sibling or
|
||||
// other family TTD block being accepted.
|
||||
if cs.handler.chain.Config().TerminalTotalDifficultyPassed {
|
||||
return nil
|
||||
}
|
||||
// Ensure we're at minimum peer count.
|
||||
minPeers := defaultMinSyncPeers
|
||||
if cs.forced {
|
||||
|
|
|
|||
Loading…
Reference in a new issue