coin filling.
This commit is contained in:
parent
512f3de412
commit
4058bba907
@ -457,32 +457,43 @@ Wallet.prototype.fill = function fill(tx, options, callback) {
|
|||||||
if (!this.initialized)
|
if (!this.initialized)
|
||||||
return callback(new Error('Wallet is not initialized.'));
|
return callback(new Error('Wallet is not initialized.'));
|
||||||
|
|
||||||
this.getCoins(options.account, function(err, coins) {
|
this.getAccount(options.account, function(err, account) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
try {
|
if (!account) {
|
||||||
tx.fill(coins, {
|
if (options.account != null)
|
||||||
selection: options.selection || 'age',
|
return callback(new Error('Account not found.'));
|
||||||
round: options.round,
|
account = self.account;
|
||||||
confirmed: options.confirmed,
|
|
||||||
free: options.free,
|
|
||||||
fee: options.fee,
|
|
||||||
subtractFee: options.subtractFee,
|
|
||||||
changeAddress: self.account.changeAddress.getAddress(),
|
|
||||||
height: self.network.height,
|
|
||||||
rate: options.rate != null
|
|
||||||
? options.rate
|
|
||||||
: self.network.getRate(),
|
|
||||||
wallet: self,
|
|
||||||
m: self.m,
|
|
||||||
n: self.n
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
return callback(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback();
|
self.getCoins(options.account, function(err, coins) {
|
||||||
|
if (err)
|
||||||
|
return callback(err);
|
||||||
|
|
||||||
|
try {
|
||||||
|
tx.fill(coins, {
|
||||||
|
selection: options.selection || 'age',
|
||||||
|
round: options.round,
|
||||||
|
confirmed: options.confirmed,
|
||||||
|
free: options.free,
|
||||||
|
fee: options.fee,
|
||||||
|
subtractFee: options.subtractFee,
|
||||||
|
changeAddress: account.changeAddress.getAddress(),
|
||||||
|
height: self.network.height,
|
||||||
|
rate: options.rate != null
|
||||||
|
? options.rate
|
||||||
|
: self.network.getRate(),
|
||||||
|
wallet: self,
|
||||||
|
m: self.m,
|
||||||
|
n: self.n
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return callback(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user