erigon-pulse/turbo/snapshotsync/snapshothashes/embed.go
Alex Sharov ecb10e8548
Snapshots download and seed (#3117)
* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* Squashed 'interfaces/' content from commit e5b1945d0

git-subtree-dir: interfaces
git-subtree-split: e5b1945d02da7a7f00e2289034ee90a6edd60184

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save
2021-12-14 10:13:17 +00:00

50 lines
917 B
Go

package snapshothashes
import (
_ "embed"
"encoding/json"
"github.com/ledgerwatch/erigon/params/networkname"
)
//go:embed erigon-snapshots/mainnet.json
var mainnet []byte
var Mainnet = fromJson(mainnet)
//go:embed erigon-snapshots/goerli.json
var goerli []byte
var Goerli = fromJson(goerli)
type Preverified map[string]string
func fromJson(in []byte) (out Preverified) {
if err := json.Unmarshal(in, &out); err != nil {
panic(err)
}
return out
}
var (
MainnetChainSnapshotConfig = &Config{}
GoerliChainSnapshotConfig = &Config{
ExpectBlocks: 5_900_000 - 1,
Preverified: Goerli,
}
)
type Config struct {
ExpectBlocks uint64
Preverified Preverified
}
func KnownConfig(networkName string) *Config {
switch networkName {
case networkname.MainnetChainName:
return MainnetChainSnapshotConfig
case networkname.GoerliChainName:
return GoerliChainSnapshotConfig
default:
return nil
}
}