fix listening on new block

auto_exec_v2
yann300 3 years ago
parent 53fd624176
commit f3073c7434
  1. 5
      libs/remix-lib/src/execution/txListener.ts

@ -133,7 +133,7 @@ export class TxListener {
*/
init () {
this.blocks = []
this.lastBlock = null
this.lastBlock = -1
}
/**
@ -170,8 +170,7 @@ export class TxListener {
this.executionContext.web3().eth.getBlockNumber((error, blockNumber) => {
if (this._loopId === null) return
if (error) return console.log(error)
if (currentLoopId === this._loopId && (!this.lastBlock || blockNumber > this.lastBlock)) {
if (!this.lastBlock) this.lastBlock = blockNumber - 1
if (currentLoopId === this._loopId && blockNumber > this.lastBlock) {
let current = this.lastBlock + 1
this.lastBlock = blockNumber
while (blockNumber >= current) {

Loading…
Cancel
Save