Commit 2f3651a5 authored by yann300's avatar yann300

add Listen on last block API

parent 9d4cbb79
......@@ -83,6 +83,9 @@ function ExecutionContext () {
var executionContext = null
this.blockGasLimitDefault = 4300000
this.blockGasLimit = this.blockGasLimitDefault
this.init = function (config) {
if (config.get('settings/always-use-vm')) {
executionContext = 'vm'
......@@ -184,10 +187,13 @@ function ExecutionContext () {
return this.blockGasLimit
}
this.blockGasLimitDefault = 4300000
this.blockGasLimit = this.blockGasLimitDefault
// removing the setinterval cause it cause tape test to hang and we don't need this.
// there's a copy of this file in remix-ide repo @TODO to refactor
this.stopListenOnLastBlock = function () {
if (this.listenOnLastBlockId) clearInterval(this.listenOnLastBlockId)
this.listenOnLastBlockId = null
}
this.listenOnLastBlock = function () {
this.listenOnLastBlockId = setInterval(() => {
if (this.getProvider() !== 'vm') {
web3.eth.getBlock('latest', (err, block) => {
if (!err) {
......@@ -196,6 +202,8 @@ function ExecutionContext () {
} else {
this.blockGasLimit = this.blockGasLimitDefault
}
}, 15000)
}
})
}
......@@ -224,4 +232,3 @@ function ExecutionContext () {
}
module.exports = new ExecutionContext()
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