better logs

This commit is contained in:
Matias Alejo Garcia 2016-02-23 16:00:34 -03:00
parent 52570d3d40
commit 791330e82f
1 changed files with 9 additions and 3 deletions

View File

@ -1158,14 +1158,20 @@ WalletService.prototype._sampleFeeLevels = function(network, points, cb) {
return cb(err);
}
var failed = [];
var levels = _.zipObject(_.map(points, function(p) {
var feePerKb = _.isObject(result) ? +result[p] : -1;
if (feePerKb < 0) {
log.info('Could not compute fee estimation (nbBlocks=' + p + ')');
}
if (feePerKb < 0)
failed.push(p);
return [p, Utils.strip(feePerKb * 1e8)];
}));
if (failed.length) {
var logger = network == 'livenet' ? log.warn : log.debug;
logger('Could not compute fee estimation in ' + network + ': ' + failed.join(','));
}
return cb(null, levels);
});
};