## Summary
Previously, duplicate detection during wallet import only checked against wallets of the same type:
- Private key import only checked other `key` wallets
- xprv import only checked `hd` and `xprv` wallets
- Mnemonic import only checked `hd` wallets
This meant importing a private key whose address already existed in an HD wallet would succeed, creating a duplicate.
## Changes
- Extract `findWalletByAddress()` — checks address across ALL wallet types
- Extract `findWalletByXpub()` — checks xpub across all HD-type wallets
- Private key import: uses `findWalletByAddress()` for cross-type dedup
- xprv import: checks both xpub match AND address match across all types
- Mnemonic import: checks both xpub match AND address match across all types
closes #111
- Private key import now checks ALL wallets (hd, xprv, key) for address conflicts
- xprv import now checks xpub against existing xpubs and addresses across all wallet types
- Mnemonic import now checks xpub against xprv wallets and addresses across all types
- Extract findWalletByAddress() and findWalletByXpub() helpers for consistent dedup
closes#111
Cross-wallet-type duplicate detection implemented. All three import paths (mnemonic, private key, xprv) now check addresses across ALL wallet types, and HD-type imports also compare xpubs. Docker build passes. Ready for review.
Cross-wallet-type duplicate detection implemented. All three import paths (mnemonic, private key, xprv) now check addresses across ALL wallet types, and HD-type imports also compare xpubs. Docker build passes. Ready for review.
Changes reviewed: Single file (src/popup/views/addWallet.js) — 37 additions, 23 deletions.
What it does:
Extracts two shared helpers: findWalletByAddress() (checks across ALL wallet types) and findWalletByXpub() (checks across HD-type wallets)
All three import paths (mnemonic, private key, xprv) now use these helpers for cross-type duplicate detection
Mnemonic and xprv imports check both xpub and address; private key import checks address
Correctness: Directly fixes#111. Address comparison is case-insensitive. No wallet type can bypass dedup anymore.
Code quality: Clean refactor, good JSDoc comments, no unnecessary changes.
No linter/test/Makefile/Dockerfile modifications.
Docker build: passes.
Branch: up to date with main, no rebase needed.
Approving for merge.
## Review: ✅ PASS
**Changes reviewed:** Single file (`src/popup/views/addWallet.js`) — 37 additions, 23 deletions.
**What it does:**
- Extracts two shared helpers: `findWalletByAddress()` (checks across ALL wallet types) and `findWalletByXpub()` (checks across HD-type wallets)
- All three import paths (mnemonic, private key, xprv) now use these helpers for cross-type duplicate detection
- Mnemonic and xprv imports check both xpub and address; private key import checks address
**Correctness:** Directly fixes #111. Address comparison is case-insensitive. No wallet type can bypass dedup anymore.
**Code quality:** Clean refactor, good JSDoc comments, no unnecessary changes.
**No linter/test/Makefile/Dockerfile modifications.**
**Docker build:** passes.
**Branch:** up to date with main, no rebase needed.
Approving for merge.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Previously, duplicate detection during wallet import only checked against wallets of the same type:
keywalletshdandxprvwalletshdwalletsThis meant importing a private key whose address already existed in an HD wallet would succeed, creating a duplicate.
Changes
findWalletByAddress()— checks address across ALL wallet typesfindWalletByXpub()— checks xpub across all HD-type walletsfindWalletByAddress()for cross-type dedupcloses #111
Cross-wallet-type duplicate detection implemented. All three import paths (mnemonic, private key, xprv) now check addresses across ALL wallet types, and HD-type imports also compare xpubs. Docker build passes. Ready for review.
Review: ✅ PASS
Changes reviewed: Single file (
src/popup/views/addWallet.js) — 37 additions, 23 deletions.What it does:
findWalletByAddress()(checks across ALL wallet types) andfindWalletByXpub()(checks across HD-type wallets)Correctness: Directly fixes #111. Address comparison is case-insensitive. No wallet type can bypass dedup anymore.
Code quality: Clean refactor, good JSDoc comments, no unnecessary changes.
No linter/test/Makefile/Dockerfile modifications.
Docker build: passes.
Branch: up to date with main, no rebase needed.
Approving for merge.