Commit 5dd991e6 authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] Wallet: Add log when get sources failed

parent e0ea2c8c
......@@ -554,7 +554,7 @@ function WalletSelectModalController($scope, $q, $timeout, UIUtils, filterTransl
return wallets.reduce(function(res, wallet) {
var skip= !options.refresh && wallet.isDataLoaded(walletLoadOptions);
if (skip) {
console.debug("[wallets] Wallet #{0} already loaded. Skipping".format(wallet.id), walletLoadOptions);
console.debug("[wallets] Wallet #{0} already loaded. Skipping".format(wallet.id));
return res.then(function(){
balance += wallet.data.balance;
$scope.updateWalletView(wallet.id);
......
......@@ -129,7 +129,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services',
return $q(function(resolve, reject) {
var nowInSec = moment().utc().unix();
fromTime = fromTime || fromTime || (nowInSec - csSettings.data.walletHistoryTimeSecond);
fromTime = fromTime || (nowInSec - csSettings.data.walletHistoryTimeSecond);
var tx = {
pendings: [],
validating: [],
......@@ -234,8 +234,8 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services',
tx.history.splice(0, tx.validating.length);
}
tx.fromTime = fromTime;
tx.toTime = tx.history.length ? tx.history[0].time /*=max(tx.time)*/: fromTime;
tx.fromTime = fromTime !== 'pending' && fromTime || undefined;
tx.toTime = tx.history.length ? tx.history[0].time /*=max(tx.time)*/: tx.fromTime;
resolve(tx);
})
......@@ -277,6 +277,10 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services',
addSources(data, res.sources);
}
return data;
})
.catch(function(err) {
console.warn("[tx] Error while getting sources...", err);
throw err;
});
},
......@@ -377,6 +381,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services',
},
loadSources = function(pubkey) {
console.debug("[tx] Loading sources for " + pubkey.substring(0,8));
return loadData(pubkey, 'pending');
};
......
......@@ -896,13 +896,19 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se
return $q.all([
// Get requirements
loadRequirements(),
loadRequirements()
.then(function(data) {
if (data.requirements && (data.requirements.isMember || data.requirements.wasMember)) {
// Load sigStock
return loadSigStock();
}
else {
data.sigStock = 0;
}
}),
// Get TX and sources
loadTxAndSources(),
// Load sigStock
loadSigStock()
loadTxAndSources()
])
.then(function() {
......@@ -1294,7 +1300,7 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se
.then(function() {
// If more money: transfer all to restPub
if (data.balance > 0 && restPub) {
console.debug("[wallet] Wallet has some more money: transfering fund to [{0}]".format(restPub.substring(0,6)));
console.debug("[wallet] Wallet has some more money: transfering fund to [{0}]".format(restPub.substring(0,8)));
return transfer(restPub, data.balance, undefined/*comments*/, false/*useRelative*/, restPub, block);
}
});
......
......@@ -60,11 +60,13 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c
data.requirements = {
loaded: false,
meta: {},
hasSelf: false,
needSelf: true,
needMembership: true,
canMembershipOut: false,
needRenew: false,
pendingMembership: false,
isMember: false,
wasMember: false,
certificationCount: 0,
needCertifications: false,
......@@ -75,11 +77,12 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c
data.blockUid = null;
data.isMember = false;
data.sigDate = null;
data.hasSelf = false;
},
_fillRequirements = function(requirements, currencyParameters) {
// Add useful custom fields
requirements.hasSelf = requirements.meta && !!requirements.meta.timestamp;
requirements.hasSelf = !!requirements.meta.timestamp;
requirements.needSelf = !requirements.hasSelf || requirements.meta.invalid;
requirements.wasMember = angular.isDefined(requirements.wasMember) ? requirements.wasMember : false; // Compat with Duniter 0.9
requirements.needMembership = (!requirements.revoked && requirements.membershipExpiresIn <= 0 && requirements.membershipPendingExpiresIn <= 0 && !requirements.wasMember);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment