fix loop setup txlistener

pull/1/head
yann300 8 years ago
parent 4dd7f3f575
commit 627e624a20
  1. 5
      src/app/execution/txListener.js

@ -62,10 +62,11 @@ class TxListener {
this.loopId = 'vm-listener'
} else {
this.loopId = setInterval(() => {
var currentLoopId = this.loopId
executionContext.web3().eth.getBlockNumber((error, blockNumber) => {
if (this.loopId === null || this.loopId === 'vm-listener') return
if (error) return console.log(error)
if (!this.lastBlock || blockNumber > this.lastBlock) {
if (currentLoopId === this.loopId && (!this.lastBlock || blockNumber > this.lastBlock)) {
this.lastBlock = blockNumber
executionContext.web3().eth.getBlock(this.lastBlock, true, (error, result) => {
if (!error) {
@ -74,7 +75,7 @@ class TxListener {
})
}
})
}, 2)
}, 2000)
}
}

Loading…
Cancel
Save