Browse Source

use BIP45 by default

activeAddress
Ivan Socolsky 10 years ago
parent
commit
004890bd6b
  1. 3
      lib/model/copayer.js
  2. 4
      lib/model/wallet.js
  3. 15
      lib/server.js

3
lib/model/copayer.js

@ -37,7 +37,8 @@ Copayer.create = function(opts) {
}]; }];
x.addressManager = AddressManager.create({ x.addressManager = AddressManager.create({
copayerIndex: opts.copayerIndex derivationStrategy: 'BIP45',
copayerIndex: opts.copayerIndex,
}); });
x.customData = opts.customData; x.customData = opts.customData;

4
lib/model/wallet.js

@ -29,7 +29,9 @@ Wallet.create = function(opts) {
x.copayers = []; x.copayers = [];
x.pubKey = opts.pubKey; x.pubKey = opts.pubKey;
x.network = opts.network; x.network = opts.network;
x.addressManager = AddressManager.create(); x.addressManager = AddressManager.create({
derivationStrategy: 'BIP45',
});
x.scanStatus = null; x.scanStatus = null;
return x; return x;

15
lib/server.js

@ -941,7 +941,10 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) {
self.getUtxos({}, function(err, utxos) { self.getUtxos({}, function(err, utxos) {
if (err) return cb(err); if (err) return cb(err);
var excludeIndex = _.reduce(utxosToExclude, function(res, val) { res[val] = val; return res; }, {}); var excludeIndex = _.reduce(utxosToExclude, function(res, val) {
res[val] = val;
return res;
}, {});
utxos = _.reject(utxos, function(utxo) { utxos = _.reject(utxos, function(utxo) {
return excludeIndex[utxo.txid + ":" + utxo.vout]; return excludeIndex[utxo.txid + ":" + utxo.vout];
@ -1817,10 +1820,12 @@ WalletService.prototype.scan = function(opts, cb) {
}); });
if (opts.includeCopayerBranches) { if (opts.includeCopayerBranches) {
_.each(wallet.copayers, function(copayer) { _.each(wallet.copayers, function(copayer) {
derivators.push({ if (copayer.addressManager.supportsDerivation()) {
derive: _.bind(copayer.createAddress, copayer, wallet, isChange), derivators.push({
rewind: _.bind(copayer.addressManager.rewindIndex, copayer.addressManager, isChange), derive: _.bind(copayer.createAddress, copayer, wallet, isChange),
}); rewind: _.bind(copayer.addressManager.rewindIndex, copayer.addressManager, isChange),
});
}
}); });
} }
}); });

Loading…
Cancel
Save