Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #107 from blockchain/add-or-import
Browse files Browse the repository at this point in the history
Add or import
  • Loading branch information
Sjors committed Feb 8, 2016
2 parents 4a5e36e + 7e3b7cf commit 936f3ef
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/blockchain-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,17 @@ Wallet.prototype.addKeyToLegacyAddress = function (privateKey, addr, secPass, bi
var modifyAddress = function (newKey) {
var watchOnlyKey = this._addresses[addr];
if (newKey.address !== watchOnlyKey.address) {
throw 'addressDoesNotMatchWithTheKey'
if (!this.containsLegacyAddress(newKey.address)) {
console.log(newKey)
return this.importLegacyAddress(privateKey, null, secPass, bipPass);
} else {
if (this.key(newKey.address).isWatchOnly) {
watchOnlyKey = this._addresses[newKey.address];
} else {
throw 'privateKeyOfAnotherNonWatchOnlyAddress'
}
}

}
watchOnlyKey._priv = newKey._priv;
if (this.isDoubleEncrypted) {
Expand Down

0 comments on commit 936f3ef

Please sign in to comment.