diff --git a/turbo/snapshotsync/snapshothashes/embed.go b/turbo/snapshotsync/snapshothashes/embed.go index 891a89317827163d9a9d0322e9bff87f294e5477..8949a45ee457dbd1de3baf4b6551b7cea636fcc1 100644 --- a/turbo/snapshotsync/snapshothashes/embed.go +++ b/turbo/snapshotsync/snapshothashes/embed.go @@ -31,6 +31,10 @@ var Ropsten = fromToml(ropsten) var mumbai []byte var Mumbai = fromToml(mumbai) +//go:embed erigon-snapshots/bor-mainnet.toml +var borMainnet []byte +var BorMainnet = fromToml(borMainnet) + type PreverifiedItem struct { Name string Hash string @@ -55,11 +59,12 @@ func doSort(in preverified) Preverified { } var ( - MainnetChainSnapshotConfig = newConfig(Mainnet) - GoerliChainSnapshotConfig = newConfig(Goerli) - BscChainSnapshotConfig = newConfig(Bsc) - RopstenChainSnapshotConfig = newConfig(Ropsten) - MumbaiChainSnapshotConfig = newConfig(Mumbai) + MainnetChainSnapshotConfig = newConfig(Mainnet) + GoerliChainSnapshotConfig = newConfig(Goerli) + BscChainSnapshotConfig = newConfig(Bsc) + RopstenChainSnapshotConfig = newConfig(Ropsten) + MumbaiChainSnapshotConfig = newConfig(Mumbai) + BorMainnetChainSnapshotConfig = newConfig(BorMainnet) ) func newConfig(preverified Preverified) *Config { @@ -101,19 +106,18 @@ type Config struct { Preverified Preverified } +var KnownConfigs map[string]*Config = map[string]*Config{ + networkname.MainnetChainName: MainnetChainSnapshotConfig, + networkname.GoerliChainName: GoerliChainSnapshotConfig, + networkname.BSCChainName: BscChainSnapshotConfig, + networkname.RopstenChainName: RopstenChainSnapshotConfig, + networkname.MumbaiChainName: MumbaiChainSnapshotConfig, + networkname.BorMainnetChainName: BorMainnetChainSnapshotConfig, +} + func KnownConfig(networkName string) *Config { - switch networkName { - case networkname.MainnetChainName: - return MainnetChainSnapshotConfig - case networkname.GoerliChainName: - return GoerliChainSnapshotConfig - case networkname.BSCChainName: - return BscChainSnapshotConfig - case networkname.RopstenChainName: - return RopstenChainSnapshotConfig - case networkname.MumbaiChainName: - return MumbaiChainSnapshotConfig - default: - return newConfig(Preverified{}) + if c, ok := KnownConfigs[networkName]; ok { + return c } + return newConfig(Preverified{}) } diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index 14bbb9bd978780573885a42091fb8d26e0d9147f..7a1edc8eef97bdbab7d78c9d6c4d2f091e0701fb 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -297,8 +297,8 @@ func (hd *HeaderDownload) logAnchorState() { ss = append(ss, sb.String()) } sort.Strings(ss) + log.Info("anchorQueue", "len", hd.anchorQueue.Len()) for _, s := range ss { - log.Info("anchorQueue", "len", hd.anchorQueue.Len()) log.Info(s) } }