Fix fractional transaction fee

This commit is contained in:
wltsmrz
2014-06-12 03:06:23 -07:00
parent 1cccf01bf2
commit 1186b4a314
2 changed files with 2 additions and 2 deletions

View File

@@ -286,7 +286,7 @@ Transaction.prototype._computeFee = function() {
var midInd = Math.floor(fees.length / 2);
var median = fees.length % 2 === 0
? (fees[midInd] + fees[midInd - 1]) / 2
? Math.floor(0.5 + (fees[midInd] + fees[midInd - 1]) / 2)
: fees[midInd];
return String(median);

View File

@@ -318,7 +318,7 @@ describe('Transaction', function() {
assert(transaction.complete());
var json = transaction.serialize().to_json();
assert(json.Fee != '66500000', 'Fee == 66500000, i.e. 66.5 XRP!');
assert.notStrictEqual(json.Fee, '66500000', 'Fee == 66500000, i.e. 66.5 XRP!');
});