Merge pull request #833 from holgerd77/fix-block-gas-limit-update

Don't run blockgaslimit update requests on provider set to vm
pull/1/head
yann300 7 years ago committed by GitHub
commit ff588cec10
  1. 18
      src/execution-context.js

@ -147,14 +147,16 @@ function ExecutionContext () {
this.blockGasLimitDefault = 4300000
this.blockGasLimit = this.blockGasLimitDefault
setInterval(() => {
web3.eth.getBlock('latest', (err, block) => {
if (!err) {
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
this.blockGasLimit = (block && block.gasLimit) ? Math.floor(block.gasLimit - (5 * block.gasLimit) / 1024) : this.blockGasLimitDefault
} else {
this.blockGasLimit = this.blockGasLimitDefault
}
})
if (this.getProvider() !== 'vm') {
web3.eth.getBlock('latest', (err, block) => {
if (!err) {
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
this.blockGasLimit = (block && block.gasLimit) ? Math.floor(block.gasLimit - (5 * block.gasLimit) / 1024) : this.blockGasLimitDefault
} else {
this.blockGasLimit = this.blockGasLimitDefault
}
})
}
}, 15000)
function setProviderFromEndpoint (endpoint) {

Loading…
Cancel
Save