Browse Source

Merge pull request #363 from isocolsky/dry_join

Dry join
activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
9d6cafc594
  1. 5
      lib/server.js
  2. 2
      package.json
  3. 26
      test/integration/server.js

5
lib/server.js

@ -423,6 +423,11 @@ WalletService.prototype._addCopayerToWallet = function(wallet, opts, cb) {
if (err) return cb(err);
if (res) return cb(Errors.COPAYER_REGISTERED);
if (opts.dryRun) return cb(null, {
copayerId: null,
wallet: wallet
});
wallet.addCopayer(copayer);
self.storage.storeWalletAndUpdateCopayersLookup(wallet, function(err) {
if (err) return cb(err);

2
package.json

@ -2,7 +2,7 @@
"name": "bitcore-wallet-service",
"description": "A service for Mutisig HD Bitcoin Wallets",
"author": "BitPay Inc",
"version": "0.2.2",
"version": "0.2.3",
"keywords": [
"bitcoin",
"copay",

26
test/integration/server.js

@ -1078,6 +1078,32 @@ describe('Wallet service', function() {
});
});
it('should be able to get wallet info without actually joining', function(done) {
var copayerOpts = helpers.getSignedCopayerOpts({
walletId: walletId,
name: 'me',
xPubKey: TestData.copayers[0].xPubKey_44H_0H_0H,
requestPubKey: TestData.copayers[0].pubKey_1H_0,
customData: 'dummy custom data',
dryRun: true,
});
server.joinWallet(copayerOpts, function(err, result) {
should.not.exist(err);
should.exist(result);
should.not.exist(result.copayerId);
result.wallet.id.should.equal(walletId);
result.wallet.m.should.equal(1);
result.wallet.n.should.equal(2);
result.wallet.copayers.should.be.empty;
server.storage.fetchWallet(walletId, function(err, wallet) {
should.not.exist(err);
wallet.id.should.equal(walletId);
wallet.copayers.should.be.empty;
done();
});
});
});
it('should fail to join two wallets with same xPubKey', function(done) {
var copayerOpts = helpers.getSignedCopayerOpts({
walletId: walletId,

Loading…
Cancel
Save