|
|
@ -761,6 +761,7 @@ WalletService._getCopayerHash = function(name, xPubKey, requestPubKey) { |
|
|
|
* Joins a wallet in creation. |
|
|
|
* @param {Object} opts |
|
|
|
* @param {string} opts.walletId - The wallet id. |
|
|
|
* @param {string} opts.coin[='btc'] - The expected coin for this wallet (btc, bch). |
|
|
|
* @param {string} opts.name - The copayer name. |
|
|
|
* @param {string} opts.xPubKey - Extended Public Key for this copayer. |
|
|
|
* @param {string} opts.requestPubKey - Public Key used to check requests from this copayer. |
|
|
@ -777,6 +778,10 @@ WalletService.prototype.joinWallet = function(opts, cb) { |
|
|
|
if (_.isEmpty(opts.name)) |
|
|
|
return cb(new ClientError('Invalid copayer name')); |
|
|
|
|
|
|
|
opts.coin = opts.coin || Defaults.COIN; |
|
|
|
if (!Utils.checkValueInCollection(opts.coin, Constants.COINS)) |
|
|
|
return cb(new ClientError('Invalid coin')); |
|
|
|
|
|
|
|
try { |
|
|
|
Bitcore.HDPublicKey(opts.xPubKey); |
|
|
|
} catch (ex) { |
|
|
@ -791,6 +796,10 @@ WalletService.prototype.joinWallet = function(opts, cb) { |
|
|
|
if (err) return cb(err); |
|
|
|
if (!wallet) return cb(Errors.WALLET_NOT_FOUND); |
|
|
|
|
|
|
|
if (opts.coin != wallet.coin) { |
|
|
|
return cb(new ClientError('The wallet you are trying to join was created for a different coin')); |
|
|
|
} |
|
|
|
|
|
|
|
if (opts.supportBIP44AndP2PKH) { |
|
|
|
// New client trying to join legacy wallet
|
|
|
|
if (wallet.derivationStrategy == Constants.DERIVATION_STRATEGIES.BIP45) { |
|
|
|