diff --git a/lib/server.js b/lib/server.js index 4f95fc6..07ba841 100644 --- a/lib/server.js +++ b/lib/server.js @@ -253,10 +253,11 @@ WalletService.prototype._emit = function(eventName, args) { /** * _notify * - * @param type - * @param data + * @param {String} type + * @param {Object} data + * @param {Boolean} isGlobal - If true, the notification is not issued on behalf of any particular copayer (defaults to false) */ -WalletService.prototype._notify = function(type, data) { +WalletService.prototype._notify = function(type, data, isGlobal) { var self = this; log.debug('Notification', type, data); @@ -270,7 +271,7 @@ WalletService.prototype._notify = function(type, data) { type: type, data: data, ticker: this.notifyTicker++, - creatorId: copayerId, + creatorId: isGlobal ? null : copayerId, walletId: walletId, }); this.storage.storeNotification(walletId, n, function() { @@ -1219,7 +1220,7 @@ WalletService.prototype.startScan = function(opts, cb) { } else { data.result = 'success'; } - self._notify('ScanFinished', data); + self._notify('ScanFinished', data, true); }; Utils.runLocked(self.walletId, cb, function(cb) { diff --git a/test/integration/server.js b/test/integration/server.js index eb0136f..fd31c01 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -2867,6 +2867,7 @@ describe('Wallet service', function() { ]; WalletService.onNotification(function(n) { if (n.type == 'ScanFinished') { + should.not.exist(n.creatorId); server.storage.fetchAddresses(wallet.id, function(err, addresses) { should.exist(addresses); addresses.length.should.equal(expectedPaths.length);