From 3f76e8a9dc1aa270e931263aa69e535094df1667 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Tue, 29 Sep 2015 18:04:54 -0400 Subject: [PATCH] Fix bug with satoshis being returned instead of bitcoin. --- lib/utils.js | 6 ++++-- test/utils.js | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 73711f2..54320b4 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -12,10 +12,12 @@ UtilsController.prototype.estimateFee = function(req, res) { var result = nbBlocks.map(function(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)); }; -module.exports = UtilsController; \ No newline at end of file +module.exports = UtilsController; diff --git a/test/utils.js b/test/utils.js index bb6e5b2..4fda011 100644 --- a/test/utils.js +++ b/test/utils.js @@ -31,11 +31,11 @@ describe('Utils', function() { var res = { jsonp: function(fees) { - should(fees).eql({1: 1000, 3: 3000}); + should(fees).eql({1: 0.00001, 3: 0.00003}); done(); } - } + }; utils.estimateFee(req, res); }); }); -}); \ No newline at end of file +});