remove noSign and getChange for now.

This commit is contained in:
Christopher Jeffrey 2015-12-05 03:55:08 -08:00
parent a2f13d94c3
commit 40fca0dda8

View File

@ -373,17 +373,9 @@ Wallet.prototype.balance = function balance() {
return this.tx.balance();
};
Wallet.prototype.fill = function fill(tx, options, cb) {
if ((cb && typeof cb === 'object') || options == null) {
cb = options;
options = {};
}
Wallet.prototype.fill = function fill(tx, cb) {
cb = utils.asyncify(cb);
if (options._getChange) {
tx = tx.clone();
}
// NOTE: tx should be prefilled with all outputs
var cost = tx.funds('out');
@ -434,10 +426,6 @@ Wallet.prototype.fill = function fill(tx, options, cb) {
// How much money is left after sending outputs
var left = tx.funds('in').sub(total);
if (options._getChange) {
return left;
}
// Not enough money, transfer everything to owner
if (left.cmpn(this.dust) < 0) {
// NOTE: that this output is either `postCost` or one of the `dust` values
@ -452,21 +440,14 @@ Wallet.prototype.fill = function fill(tx, options, cb) {
tx.outputs[tx.outputs.length - 1].value = left;
// Sign transaction
if (options.sign === false) {
this.signEmpty(tx);
} else {
this.sign(tx);
}
// XXX Do not necessarily call this here
this.sign(tx);
cb(null, tx);
return tx;
};
Wallet.prototype.getChange = function fill(tx) {
return this.fill(tx, { _getChange: true });
};
/**
* P2SH+Multisig Redemption
*/