Skip to content

Commit

Permalink
version 2 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 committed Dec 8, 2021
1 parent 854aa50 commit 4713232
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
36 changes: 19 additions & 17 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var (
FermionGenesisStateRoot = common.HexToHash("0x08982dc16236c51b6d9aff8b76cd0faa7067eb55eba62395d5a82649d8fb73c4")
)

var l, _ = (&big.Int{}).SetString("33215836366709145919159", 10)
var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = &ChainConfig{
Expand All @@ -87,7 +88,7 @@ var (
MuirGlacierBlock: big.NewInt(9_200_000),
BerlinBlock: big.NewInt(12_244_000),
LondonBlock: big.NewInt(12_965_000),
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficulty: l,
ArrowGlacierBlock: big.NewInt(13_773_000),
Ethash: new(EthashConfig),
}
Expand Down Expand Up @@ -141,22 +142,23 @@ var (

// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
GoerliChainConfig = &ChainConfig{
ChainName: GoerliChainName,
ChainID: big.NewInt(5),
Consensus: CliqueConsensus,
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(1_561_651),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(4_460_644),
LondonBlock: big.NewInt(5_062_605),
ChainName: GoerliChainName,
ChainID: big.NewInt(5),
Consensus: CliqueConsensus,
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(1_561_651),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(4_460_644),
LondonBlock: big.NewInt(5_062_605),
TerminalTotalDifficulty: big.NewInt(5867669),
Clique: &CliqueConfig{
Period: 15,
Epoch: 30000,
Expand Down
12 changes: 11 additions & 1 deletion turbo/stages/headerdownload/header_algos.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,24 @@ func (hd *HeaderDownload) InsertHeadersBackwards(tx kv.RwTx, logPrefix string, l
}
// This is the parent of the last processed block
if header.Hash() != hd.expectedHash {
return false, fmt.Errorf("invalid header ")
hd.fetched[header.Number.Uint64()] = false
hd.CurrentNumber = hd.lastProcessedPayload
break
}
rawdb.WriteHeader(tx, &header)
if err := rawdb.WriteCanonicalHash(tx, header.Hash(), header.Number.Uint64()); err != nil {
return false, err
}
hd.lastProcessedPayload--
hd.expectedHash = header.ParentHash

canonical, err := rawdb.ReadCanonicalHash(tx, hd.lastProcessedPayload-1)
if err != nil {
return false, err
}
if canonical == hd.expectedHash {
return true, nil
}
hd.PosHeaders = hd.PosHeaders[1:]
}
return false, nil
Expand Down

0 comments on commit 4713232

Please sign in to comment.