diff --git a/bchain/coins/eth/ethrpc.go b/bchain/coins/eth/ethrpc.go index 1412b0e7..6ed4b144 100644 --- a/bchain/coins/eth/ethrpc.go +++ b/bchain/coins/eth/ethrpc.go @@ -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 } diff --git a/bchain/coins/eth/stakingpool.go b/bchain/coins/eth/stakingpool.go index f773dae9..659307c8 100644 --- a/bchain/coins/eth/stakingpool.go +++ b/bchain/coins/eth/stakingpool.go @@ -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) diff --git a/db/bulkconnect.go b/db/bulkconnect.go index 2a044bc1..8c2095bf 100644 --- a/db/bulkconnect.go +++ b/db/bulkconnect.go @@ -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 } diff --git a/fiat/fiat_rates.go b/fiat/fiat_rates.go index 13e7168f..d6ead4bb 100644 --- a/fiat/fiat_rates.go +++ b/fiat/fiat_rates.go @@ -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