Ensure account-tracker currentBlockNumber is set on first block update.

This commit is contained in:
Dan Miller 2018-09-11 12:51:49 -02:30
parent 1552fe1c3e
commit eb32ccb0c7
1 changed files with 3 additions and 0 deletions

View File

@ -45,6 +45,9 @@ class AccountTracker {
this._blockTracker = opts.blockTracker
// blockTracker.currentBlock may be null
this._currentBlockNumber = this._blockTracker.getCurrentBlock()
this._blockTracker.once('latest', blockNumber => {
this._currentBlockNumber = blockNumber
})
// bind function for easier listener syntax
this._updateForBlock = this._updateForBlock.bind(this)
}