From d9d5a26085c41b1e030c0ca5213dadf5f1e6d13f Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Wed, 10 Jun 2015 17:37:48 -0300 Subject: [PATCH] fix computation of fee without change output --- lib/transaction/transaction.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/transaction/transaction.js b/lib/transaction/transaction.js index 232dafe..1a88810 100644 --- a/lib/transaction/transaction.js +++ b/lib/transaction/transaction.js @@ -205,7 +205,7 @@ Transaction.prototype.getSerializationError = function(opts) { unspentError = this._hasFeeError(opts, unspent); } - return unspentError || + return unspentError || this._hasDustOutputs(opts) || this._isMissingSignatures(opts); }; @@ -394,7 +394,7 @@ Transaction.prototype._checkConsistency = function() { $.checkState(this._changeScript); $.checkState(this.outputs[this._changeIndex]); $.checkState(this.outputs[this._changeIndex].script.toString() === - this._changeScript.toString()); + this._changeScript.toString()); } // TODO: add other checks }; @@ -845,7 +845,7 @@ Transaction.prototype._clearSignatures = function() { }; Transaction._estimateFee = function(size, amountAvailable) { - var fee = Math.ceil(size / Transaction.FEE_PER_KB); + var fee = Math.ceil(size / 1000) * Transaction.FEE_PER_KB; if (amountAvailable > fee) { size += Transaction.CHANGE_OUTPUT_MAX_SIZE; }