remove noSign and getChange for now.
This commit is contained in:
parent
a2f13d94c3
commit
40fca0dda8
@ -373,17 +373,9 @@ Wallet.prototype.balance = function balance() {
|
|||||||
return this.tx.balance();
|
return this.tx.balance();
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.fill = function fill(tx, options, cb) {
|
Wallet.prototype.fill = function fill(tx, cb) {
|
||||||
if ((cb && typeof cb === 'object') || options == null) {
|
|
||||||
cb = options;
|
|
||||||
options = {};
|
|
||||||
}
|
|
||||||
cb = utils.asyncify(cb);
|
cb = utils.asyncify(cb);
|
||||||
|
|
||||||
if (options._getChange) {
|
|
||||||
tx = tx.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: tx should be prefilled with all outputs
|
// NOTE: tx should be prefilled with all outputs
|
||||||
var cost = tx.funds('out');
|
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
|
// How much money is left after sending outputs
|
||||||
var left = tx.funds('in').sub(total);
|
var left = tx.funds('in').sub(total);
|
||||||
|
|
||||||
if (options._getChange) {
|
|
||||||
return left;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not enough money, transfer everything to owner
|
// Not enough money, transfer everything to owner
|
||||||
if (left.cmpn(this.dust) < 0) {
|
if (left.cmpn(this.dust) < 0) {
|
||||||
// NOTE: that this output is either `postCost` or one of the `dust` values
|
// 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;
|
tx.outputs[tx.outputs.length - 1].value = left;
|
||||||
|
|
||||||
// Sign transaction
|
// Sign transaction
|
||||||
if (options.sign === false) {
|
// XXX Do not necessarily call this here
|
||||||
this.signEmpty(tx);
|
this.sign(tx);
|
||||||
} else {
|
|
||||||
this.sign(tx);
|
|
||||||
}
|
|
||||||
|
|
||||||
cb(null, tx);
|
cb(null, tx);
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.getChange = function fill(tx) {
|
|
||||||
return this.fill(tx, { _getChange: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* P2SH+Multisig Redemption
|
* P2SH+Multisig Redemption
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user