diff --git a/lib/bcoin/tx-pool.js b/lib/bcoin/tx-pool.js index fe9d7ef8..03ddaae5 100644 --- a/lib/bcoin/tx-pool.js +++ b/lib/bcoin/tx-pool.js @@ -100,7 +100,7 @@ TXPool.prototype.add = function add(tx, noWrite) { if (!own) { if (updated) - this.emit('update', this._lastTs); + this.emit('update', this._lastTs, tx); // Save spending TXs without adding unspents if (this._storage && this._wallet.ownInput(tx)) @@ -143,7 +143,7 @@ TXPool.prototype.add = function add(tx, noWrite) { this._lastTs = Math.max(tx.ts, this._lastTs); if (updated) - this.emit('update', this._lastTs); + this.emit('update', this._lastTs, tx); if (!noWrite) this._storeTX(hash, tx); diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 0f8eecfb..ab4dbc0f 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -54,10 +54,11 @@ Wallet.prototype._init = function init() { // Notify owners about new accepted transactions var self = this; var prevBalance = null; - this.tx.on('update', function() { + this.tx.on('update', function(lastTs, tx) { var b = this.balance(); if (prevBalance && prevBalance.cmp(b) !== 0) self.emit('balance', b); + self.emit('update', tx); prevBalance = b; });