Browse Source

make ScanFinish a global notification

activeAddress
Ivan Socolsky 10 years ago
parent
commit
47a7f5ef65
  1. 11
      lib/server.js
  2. 1
      test/integration/server.js

11
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) {

1
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);

Loading…
Cancel
Save