more fill errors. refactor.

This commit is contained in:
Christopher Jeffrey 2016-03-31 05:28:50 -07:00
parent f7bdcfdfb2
commit 3242f39972

View File

@ -803,13 +803,8 @@ MTX.prototype.maxSize = function maxSize(maxM, maxN) {
};
MTX.prototype.selectCoins = function selectCoins(coins, options) {
var tx = this.clone();
var outputValue = tx.getOutputValue();
var chosen = [];
var lastAdded = 0;
var tryFree, minValue, i, size, change, fee;
assert(tx.inputs.length === 0);
var chosen, lastAdded, tx, outputValue;
var i, size, change, fee, tryFree, minValue;
if (!options || typeof options !== 'object') {
options = {
@ -818,6 +813,13 @@ MTX.prototype.selectCoins = function selectCoins(coins, options) {
};
}
tx = this.clone();
tx.inputs.length = 0;
chosen = [];
lastAdded = 0;
outputValue = tx.getOutputValue();
tryFree = options.free;
if (!options.selection || options.selection === 'age') {
@ -957,6 +959,7 @@ MTX.prototype.fill = function fill(coins, options) {
var result, err;
assert(this.ts === 0, 'Cannot modify a confirmed tx.');
assert(this.inputs.length === 0, 'TX is already filled.');
if (!options || typeof options !== 'object') {
options = {