Commit d91c5413 authored by holgerd77's avatar holgerd77

Don't run blockgaslimit update requests on provider set to vm

parent d3487207
...@@ -147,14 +147,16 @@ function ExecutionContext () { ...@@ -147,14 +147,16 @@ function ExecutionContext () {
this.blockGasLimitDefault = 4300000 this.blockGasLimitDefault = 4300000
this.blockGasLimit = this.blockGasLimitDefault this.blockGasLimit = this.blockGasLimitDefault
setInterval(() => { setInterval(() => {
web3.eth.getBlock('latest', (err, block) => { if (this.getProvider() !== 'vm') {
if (!err) { web3.eth.getBlock('latest', (err, block) => {
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506 if (!err) {
this.blockGasLimit = (block && block.gasLimit) ? Math.floor(block.gasLimit - (5 * block.gasLimit) / 1024) : this.blockGasLimitDefault // we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
} else { this.blockGasLimit = (block && block.gasLimit) ? Math.floor(block.gasLimit - (5 * block.gasLimit) / 1024) : this.blockGasLimitDefault
this.blockGasLimit = this.blockGasLimitDefault } else {
} this.blockGasLimit = this.blockGasLimitDefault
}) }
})
}
}, 15000) }, 15000)
function setProviderFromEndpoint (endpoint) { function setProviderFromEndpoint (endpoint) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment