Skip to content

Commit

Permalink
Fix totalMaxSizeKB calculation so it floors at 1 KB
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp committed Feb 23, 2016
1 parent 8476a19 commit a583538
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r

// KB to send max
if (self.totalBytesToSendMax) {
var feeToSendMaxSat = parseInt(((self.totalBytesToSendMax * feePerKb) / 1000.).toFixed(0));
// Calculate max size in KB, must be atleast 1.
var totalMaxSizeKB = self.totalBytesToSendMax / 1000;
totalMaxSizeKB = totalMaxSizeKB < 1 ? 1 : totalMaxSizeKB;

var feeToSendMaxSat = parseInt((totalMaxSizeKB * feePerKb).toFixed(0));
self.feeRateToSendMax = feePerKb;
self.availableMaxBalance = strip((self.availableBalanceSat - feeToSendMaxSat) * self.satToUnit);
self.feeToSendMaxStr = profileService.formatAmount(feeToSendMaxSat) + ' ' + self.unitName;
Expand Down

0 comments on commit a583538

Please sign in to comment.