Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behavior if *_GAS_PRICE_UPDATE_INTERVAL is not defined #83

Closed
akolotov opened this issue Sep 26, 2018 · 1 comment
Closed
Assignees

Comments

@akolotov
Copy link
Collaborator

If there is no gas price oracle for particular network it seems logical to not define any of these parameters:

*_GAS_PRICE_ORACLE_URL=
*_GAS_PRICE_SPEED_TYPE=
*_GAS_PRICE_UPDATE_INTERVAL=

At the same time it makes sense to configure *_GAS_PRICE_FALLBACK assuming that it will be used if the gas price values will not be available from the contract.

If such configuration is used the following code does not work properly since updateInterval is undefined.

  fetchGasPriceInterval = setInterval(async () => {                                                                                                                                                         
    const gasPrice = await fetchGasPrice({                                                                                                                                                                  
      bridgeContract,                                                                                                                                                                                       
      oracleFn: () => fetchGasPriceFromOracle(oracleUrl, speedType)                                                                                                                                         
    })                                                                                                                                                                                                      
    cachedGasPrice = gasPrice || cachedGasPrice                                                                                                                                                             
    logger.info(`Updated gas price: ${cachedGasPrice}`)                                                                                                                                                     
  }, updateInterval)                                                                                                                                                                                        

Consider to initialize updateInterval in some default value if *_GAS_PRICE_UPDATE_INTERVAL is not configured.

@akolotov
Copy link
Collaborator Author

Addressed in #95

@ghost ghost removed the review label Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants