Fix usage of Network configuration parameter
This commit is contained in:
parent
a4f1730364
commit
c3cdf9bca4
@ -160,12 +160,7 @@ func (b *EthereumRPC) Initialize() error {
|
|||||||
return errors.Errorf("Unknown network id %v", id)
|
return errors.Errorf("Unknown network id %v", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
networkConfig := b.ChainConfig.Network
|
err = b.initStakingPools()
|
||||||
if networkConfig == "" {
|
|
||||||
networkConfig = b.ChainConfig.CoinShortcut
|
|
||||||
}
|
|
||||||
|
|
||||||
err = b.initStakingPools(networkConfig)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,11 @@ import (
|
|||||||
"github.com/trezor/blockbook/bchain"
|
"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
|
// for now only single staking pool
|
||||||
envVar := strings.ToUpper(network) + "_STAKING_POOL_CONTRACT"
|
envVar := strings.ToUpper(network) + "_STAKING_POOL_CONTRACT"
|
||||||
envValue := os.Getenv(envVar)
|
envValue := os.Getenv(envVar)
|
||||||
|
|||||||
@ -438,6 +438,11 @@ func (b *BulkConnect) Close() error {
|
|||||||
return err
|
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()
|
bt, err := b.d.loadBlockTimes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -446,11 +451,7 @@ func (b *BulkConnect) Close() error {
|
|||||||
if b.d.metrics != nil {
|
if b.d.metrics != nil {
|
||||||
b.d.metrics.AvgBlockPeriod.Set(float64(avg))
|
b.d.metrics.AvgBlockPeriod.Set(float64(avg))
|
||||||
}
|
}
|
||||||
|
glog.Info("rocksdb: processed block times")
|
||||||
if err := b.d.SetInconsistentState(false); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
glog.Info("rocksdb: bulk connect closed, db set to open state")
|
|
||||||
b.d = nil
|
b.d = nil
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
// a small hack - in tests the callback is not used, therefore there is no delay slowing down the test
|
||||||
throttle = false
|
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 {
|
if is != nil {
|
||||||
is.HasFiatRates = true
|
is.HasFiatRates = true
|
||||||
is.HasTokenFiatRates = fr.downloadTokens
|
is.HasTokenFiatRates = fr.downloadTokens
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user