Fix bug with satoshis being returned instead of bitcoin.
This commit is contained in:
parent
8625c23e81
commit
3f76e8a9dc
@ -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;
|
||||||
|
|||||||
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user