minor.
This commit is contained in:
parent
018ce13815
commit
dda07e8eab
@ -127,10 +127,12 @@ MTX.prototype.addInput = function addInput(options, index) {
|
||||
|
||||
assert(this.ts === 0, 'Cannot modify a confirmed tx.');
|
||||
|
||||
if (options instanceof MTX)
|
||||
if (options instanceof bcoin.tx)
|
||||
options = bcoin.coin(options, index);
|
||||
|
||||
if (options instanceof bcoin.coin) {
|
||||
assert(typeof options.hash === 'string');
|
||||
assert(typeof options.index === 'number');
|
||||
options = {
|
||||
prevout: { hash: options.hash, index: options.index },
|
||||
coin: options
|
||||
@ -901,7 +903,7 @@ MTX.prototype.selectCoins = function selectCoins(coins, options) {
|
||||
var i, index;
|
||||
|
||||
for (i = lastAdded; i < coins.length; i++) {
|
||||
// Add new inputs until MTX will have enough
|
||||
// Add new inputs until TX will have enough
|
||||
// funds to cover both minimum post cost
|
||||
// and fee.
|
||||
tx.addInput(coins[i]);
|
||||
@ -929,7 +931,7 @@ MTX.prototype.selectCoins = function selectCoins(coins, options) {
|
||||
addCoins();
|
||||
|
||||
// Add dummy output (for `change`) to
|
||||
// calculate maximum MTX size.
|
||||
// calculate maximum TX size.
|
||||
tx.addOutput({
|
||||
address: options.changeAddress,
|
||||
value: new bn(0)
|
||||
|
||||
@ -601,9 +601,12 @@ TX.prototype.fillCoins = function fillCoins(coins) {
|
||||
coins = coins.reduce(function(out, coin) {
|
||||
if (coin instanceof TX) {
|
||||
out[coin.hash('hex')] = coin;
|
||||
} else {
|
||||
} else if (coin instanceof bcoin.coin) {
|
||||
assert(typeof coin.hash === 'string');
|
||||
assert(typeof coin.index === 'number');
|
||||
out[coin.hash + '/' + coin.index] = coin;
|
||||
} else {
|
||||
assert(false, 'Non-coin object passed to fillCoins.');
|
||||
}
|
||||
return out;
|
||||
}, {});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user