Merge pull request #383 from braydonf/bug/estimatefee

Fix bug with satoshis being returned instead of bitcoin.
This commit is contained in:
Patrick Nagurny 2015-09-30 10:14:24 -04:00
commit 2a1f9706e3
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);
}); });
}); });
}); });