Fix bug with satoshis being returned instead of bitcoin.

This commit is contained in:
Braydon Fuller 2015-09-29 18:04:54 -04:00
parent 8625c23e81
commit 3f76e8a9dc
2 changed files with 7 additions and 5 deletions

View File

@ -12,10 +12,12 @@ UtilsController.prototype.estimateFee = function(req, res) {
var result = nbBlocks.map(function(n) { var result = nbBlocks.map(function(n) {
var num = parseInt(n); var num = parseInt(n);
return [num, self.node.services.bitcoind.estimateFee(num)]; // Insight and Bitcoin JSON-RPC return bitcoin for this value (instead of satoshis).
var fee = self.node.services.bitcoind.estimateFee(num) / 1e8;
return [num, fee];
}); });
res.jsonp(_.zipObject(result)); res.jsonp(_.zipObject(result));
}; };
module.exports = UtilsController; module.exports = UtilsController;

View File

@ -31,11 +31,11 @@ describe('Utils', function() {
var res = { var res = {
jsonp: function(fees) { jsonp: function(fees) {
should(fees).eql({1: 1000, 3: 3000}); should(fees).eql({1: 0.00001, 3: 0.00003});
done(); done();
} }
} };
utils.estimateFee(req, res); utils.estimateFee(req, res);
}); });
}); });
}); });