|
|
@ -831,9 +831,13 @@ Transaction.prototype.sortOutputs = function(sortingFunction) { |
|
|
|
|
|
|
|
Transaction.prototype._newOutputOrder = function(newOutputs) { |
|
|
|
var changeIndex = 0; |
|
|
|
while (this.outputs[this._changeIndex] !== newOutputs[changeIndex]) { |
|
|
|
var length = this.outputs.length; |
|
|
|
while (changeIndex < length && this.outputs[this._changeIndex] !== newOutputs[changeIndex]) { |
|
|
|
changeIndex++; |
|
|
|
} |
|
|
|
if (changeIndex === length) { |
|
|
|
throw new errors.Transaction.InvalidSorting(); |
|
|
|
} |
|
|
|
this.outputs = newOutputs; |
|
|
|
this._changeIndex = changeIndex; |
|
|
|
return this; |
|
|
|