fix computation of fee without change output

This commit is contained in:
Ivan Socolsky 2015-06-10 17:37:48 -03:00
parent 49e621f4f2
commit d9d5a26085
1 changed files with 3 additions and 3 deletions

View File

@ -205,7 +205,7 @@ Transaction.prototype.getSerializationError = function(opts) {
unspentError = this._hasFeeError(opts, unspent); unspentError = this._hasFeeError(opts, unspent);
} }
return unspentError || return unspentError ||
this._hasDustOutputs(opts) || this._hasDustOutputs(opts) ||
this._isMissingSignatures(opts); this._isMissingSignatures(opts);
}; };
@ -394,7 +394,7 @@ Transaction.prototype._checkConsistency = function() {
$.checkState(this._changeScript); $.checkState(this._changeScript);
$.checkState(this.outputs[this._changeIndex]); $.checkState(this.outputs[this._changeIndex]);
$.checkState(this.outputs[this._changeIndex].script.toString() === $.checkState(this.outputs[this._changeIndex].script.toString() ===
this._changeScript.toString()); this._changeScript.toString());
} }
// TODO: add other checks // TODO: add other checks
}; };
@ -845,7 +845,7 @@ Transaction.prototype._clearSignatures = function() {
}; };
Transaction._estimateFee = function(size, amountAvailable) { 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) { if (amountAvailable > fee) {
size += Transaction.CHANGE_OUTPUT_MAX_SIZE; size += Transaction.CHANGE_OUTPUT_MAX_SIZE;
} }