wallet: account options.
This commit is contained in:
parent
b36491dd53
commit
56e4bace42
@ -665,21 +665,21 @@ Wallet.prototype._createAccount = co(function* createAccount(options) {
|
||||
throw new Error('Cannot add xprivkey to watch-only wallet.');
|
||||
} else {
|
||||
key = master.deriveAccount44(this.accountDepth);
|
||||
key = key.hdPublicKey;
|
||||
}
|
||||
|
||||
options = {
|
||||
network: this.network,
|
||||
wid: this.wid,
|
||||
id: this.id,
|
||||
name: this.accountDepth === 0 ? 'default' : name,
|
||||
witness: options.witness,
|
||||
accountKey: key.hdPublicKey,
|
||||
watchOnly: this.watchOnly,
|
||||
accountKey: key,
|
||||
accountIndex: this.accountDepth,
|
||||
type: options.type,
|
||||
keys: options.keys,
|
||||
m: options.m,
|
||||
n: options.n,
|
||||
watchOnly: this.watchOnly
|
||||
keys: options.keys
|
||||
};
|
||||
|
||||
this.start();
|
||||
@ -706,16 +706,16 @@ Wallet.prototype._createAccount = co(function* createAccount(options) {
|
||||
*/
|
||||
|
||||
Wallet.prototype.ensureAccount = co(function* ensureAccount(options) {
|
||||
var acct = options.account;
|
||||
var name = options.account;
|
||||
var exists;
|
||||
|
||||
if (typeof options.name === 'string')
|
||||
acct = options.name;
|
||||
name = options.name;
|
||||
|
||||
exists = yield this.hasAccount(acct);
|
||||
exists = yield this.hasAccount(name);
|
||||
|
||||
if (exists)
|
||||
return yield this.getAccount(acct);
|
||||
return yield this.getAccount(name);
|
||||
|
||||
return this.createAccount(options);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user