mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
29 lines
520 B
Go
29 lines
520 B
Go
package tool
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/chain"
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
|
"github.com/ledgerwatch/erigon/core/rawdb"
|
|
)
|
|
|
|
func Check(e error) {
|
|
if e != nil {
|
|
panic(e)
|
|
}
|
|
}
|
|
|
|
func ParseFloat64(str string) float64 {
|
|
v, _ := strconv.ParseFloat(str, 64)
|
|
return v
|
|
}
|
|
|
|
func ChainConfig(tx kv.Tx) *chain.Config {
|
|
genesisBlockHash, err := rawdb.ReadCanonicalHash(tx, 0)
|
|
Check(err)
|
|
chainConfig, err := rawdb.ReadChainConfig(tx, genesisBlockHash)
|
|
Check(err)
|
|
return chainConfig
|
|
}
|