Skip to content

Commit 33aec0d

Browse files
committed
fix(Wallet): bind contexts
Some methods weren't being bound, which caused problems when passing the callbacks to different contexts.
1 parent 4864dae commit 33aec0d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/wallet.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ Wallet.prototype._update = function () {
182182
this.chain.getBlockAtTime(this.state.createdAt - TIME_MARGIN, function (err, block) {
183183
if (err) return self._error(err)
184184
self.state.tip = block
185-
self._saveState()
186-
self._scanChain()
185+
self._saveState(self._scanChain.bind(self))
187186
})
188187
return
189188
}
@@ -201,7 +200,7 @@ Wallet.prototype._scanChain = function (opts) {
201200
if (err) return self._error(err)
202201

203202
if (path.remove.length > 0) {
204-
async.eachSeries(path.remove, self._unprocessBlock, function (err) {
203+
async.eachSeries(path.remove, self._unprocessBlock.bind(self), function (err) {
205204
if (err) return self._error(err)
206205
processTransactions()
207206
})

0 commit comments

Comments
 (0)