Fix usage of Network configuration parameter

This commit is contained in:
Martin Boehm 2024-12-09 20:57:37 +01:00
parent a4f1730364
commit c3cdf9bca4
4 changed files with 13 additions and 13 deletions

View File

@ -160,12 +160,7 @@ func (b *EthereumRPC) Initialize() error {
return errors.Errorf("Unknown network id %v", id)
}
networkConfig := b.ChainConfig.Network
if networkConfig == "" {
networkConfig = b.ChainConfig.CoinShortcut
}
err = b.initStakingPools(networkConfig)
err = b.initStakingPools()
if err != nil {
return err
}

View File

@ -11,7 +11,11 @@ import (
"github.com/trezor/blockbook/bchain"
)
func (b *EthereumRPC) initStakingPools(network string) error {
func (b *EthereumRPC) initStakingPools() error {
network := b.ChainConfig.Network
if network == "" {
network = b.ChainConfig.CoinShortcut
}
// for now only single staking pool
envVar := strings.ToUpper(network) + "_STAKING_POOL_CONTRACT"
envValue := os.Getenv(envVar)

View File

@ -438,6 +438,11 @@ func (b *BulkConnect) Close() error {
return err
}
}
if err := b.d.SetInconsistentState(false); err != nil {
return err
}
glog.Info("rocksdb: bulk connect closed, db set to open state")
bt, err := b.d.loadBlockTimes()
if err != nil {
return err
@ -446,11 +451,7 @@ func (b *BulkConnect) Close() error {
if b.d.metrics != nil {
b.d.metrics.AvgBlockPeriod.Set(float64(avg))
}
if err := b.d.SetInconsistentState(false); err != nil {
return err
}
glog.Info("rocksdb: bulk connect closed, db set to open state")
glog.Info("rocksdb: processed block times")
b.d = nil
return nil
}

View File

@ -108,7 +108,7 @@ func NewFiatRates(db *db.RocksDB, config *common.Config, metrics *common.Metrics
// a small hack - in tests the callback is not used, therefore there is no delay slowing down the test
throttle = false
}
fr.downloader = NewCoinGeckoDownloader(db, db.GetInternalState().CoinShortcut, rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, fr.allowedVsCurrencies, fr.timeFormat, metrics, throttle)
fr.downloader = NewCoinGeckoDownloader(db, db.GetInternalState().GetNetwork(), rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, fr.allowedVsCurrencies, fr.timeFormat, metrics, throttle)
if is != nil {
is.HasFiatRates = true
is.HasTokenFiatRates = fr.downloadTokens