commit
1333dd6ab7
|
@ -14,7 +14,9 @@ var Lock = require('./lock');
|
|||
var Notification = require('./model/notification');
|
||||
|
||||
var WalletService = require('./server');
|
||||
var Constants = require('./common/constants');
|
||||
var Common = require('./common');
|
||||
var Constants = Common.Constants;
|
||||
var Utils = Common.Utils;
|
||||
|
||||
function BlockchainMonitor() {};
|
||||
|
||||
|
@ -157,6 +159,11 @@ BlockchainMonitor.prototype._handleIncomingPayments = function(coin, network, da
|
|||
var outs = _.compact(_.map(data.vout, function(v) {
|
||||
var addr = _.keys(v)[0];
|
||||
|
||||
// This is because a bug on insight, that always return no copay addr
|
||||
if (coin == 'bch' && Utils.getAddressCoin(addr) !='bch') {
|
||||
addr = Utils.translateAddress(addr, coin);
|
||||
}
|
||||
|
||||
return {
|
||||
address: addr,
|
||||
amount: +v[addr]
|
||||
|
@ -165,6 +172,8 @@ BlockchainMonitor.prototype._handleIncomingPayments = function(coin, network, da
|
|||
if (_.isEmpty(outs)) return;
|
||||
|
||||
async.each(outs, function(out, next) {
|
||||
|
||||
// toDo, remove coin here: no more same address for diff coins
|
||||
self.storage.fetchAddressByCoin(coin, out.address, function(err, address) {
|
||||
if (err) {
|
||||
log.error('Could not fetch addresses from the db');
|
||||
|
|
|
@ -189,7 +189,7 @@ PushNotificationsService.prototype._checkShouldSendNotif = function(notification
|
|||
|
||||
if (notification.type != 'NewTxProposal') return cb(null, true);
|
||||
self.storage.fetchWallet(notification.walletId, function(err, wallet) {
|
||||
return cb(err, wallet.m > 1);
|
||||
return cb(err, wallet && wallet.m > 1);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -297,7 +297,7 @@ PushNotificationsService.prototype._getDataForTemplate = function(notification,
|
|||
}
|
||||
|
||||
self.storage.fetchWallet(notification.walletId, function(err, wallet) {
|
||||
if (err) return cb(err);
|
||||
if (err || !wallet) return cb(err);
|
||||
|
||||
data.walletId = wallet.id;
|
||||
data.walletName = wallet.name;
|
||||
|
|
Loading…
Reference in New Issue