Skip to content

Fix connection error 6f00 for Ledger Nano S+#81

Merged
justanwar merged 2 commits intomasterfrom
ledger_fix
Apr 22, 2026
Merged

Fix connection error 6f00 for Ledger Nano S+#81
justanwar merged 2 commits intomasterfrom
ledger_fix

Conversation

@levoncrypto
Copy link
Copy Markdown

No description provided.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 17, 2026

User [email protected] does not have a PR Review subscription.

Go to Team management and add this email to the PR Review subscription.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Warning

Rate limit exceeded

@levoncrypto has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7486a1dd-cb98-44e3-9815-5ee49ea87529

📥 Commits

Reviewing files that changed from the base of the PR and between a68a41a and 63baf3f.

📒 Files selected for processing (1)
  • electrum_dash/plugins/ledger/ledger.py

Walkthrough

The Ledger plugin's get_xpub method is modified to special-case certain BIP32 derivation paths, rewriting them to include the coin type when matching specific encryption-related paths, and an import for encryption derivation detection is added.

Changes

Cohort / File(s) Summary
Ledger Hardware Wallet Path Handling
electrum_dash/plugins/ledger/ledger.py
Added import of get_derivation_used_for_hw_device_encryption from electrum_firo.storage. Modified Ledger_Client.get_xpub() to detect and rewrite specific BIP32 paths ("m/0'" or encryption derivation path) by injecting the coin type into the derivation. Removed commented-out code for manual fingerprint computation and PIN handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether a description relates to the changeset. Add a pull request description explaining the nature of error 6f00, why the path rewriting logic fixes it, and any testing performed to verify the fix.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix connection error 6f00 for Ledger Nano S+' directly describes the bug fix being addressed in the changeset, which updates Ledger device path handling to resolve this specific error.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ledger_fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
electrum_dash/plugins/ledger/ledger.py (1)

227-228: Minor: tighten the path rewrite and avoid string slicing.

bip32_path[1:] relies on both branches starting with exactly "m". It works today, but a small refactor makes the intent obvious and avoids surprises if the encryption path helper ever returns a differently formatted string:

♻️ Proposed refactor
-        if bip32_path == "m/0'" or bip32_path == get_derivation_used_for_hw_device_encryption():
-            bip32_path = "m/44'/{}'".format(constants.net.BIP44_COIN_TYPE) + bip32_path[1:]
+        # Nano S+ rejects non-BIP44 derivation prefixes with 6f00, so wrap the
+        # internal-use paths under m/44'/<coin_type>'/... before querying.
+        _BIP44_WRAPPED_PATHS = ("m/0'", get_derivation_used_for_hw_device_encryption())
+        if bip32_path in _BIP44_WRAPPED_PATHS:
+            assert bip32_path.startswith("m/")
+            bip32_path = "m/44'/{}'/{}".format(
+                constants.net.BIP44_COIN_TYPE, bip32_path[2:])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@electrum_dash/plugins/ledger/ledger.py` around lines 227 - 228, The
path-rewrite currently slices bip32_path with bip32_path[1:], which assumes it
starts with "m" and is brittle; change the rewrite in the branch that checks
bip32_path == "m/0'" or bip32_path ==
get_derivation_used_for_hw_device_encryption() to build the new path explicitly
by extracting the suffix after the first "/" (e.g. suffix =
bip32_path.split("/", 1)[1] if "/" in bip32_path else bip32_path) and then set
bip32_path = "m/44'/{coin}'/".format(coin=constants.net.BIP44_COIN_TYPE) +
suffix, referencing bip32_path, get_derivation_used_for_hw_device_encryption(),
and constants.net.BIP44_COIN_TYPE to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@electrum_dash/plugins/ledger/ledger.py`:
- Around line 227-228: The change rewrites bip32_path (the conditional that
matches bip32_path == "m/0'" or bip32_path ==
get_derivation_used_for_hw_device_encryption()) to a BIP44 path which breaks
existing _soft_device_id fingerprints and storage encryption; revert silent
rewrite and implement a migration/fallback: stop forcing the rewrite in
get_xpub()/ledger.py and instead (1) add fallback decryption in
storage.decrypt() to try the old-derivation-derived password if the new
derivation fails, (2) preserve previous device id behavior by keeping the old
fingerprint when detecting legacy wallets (or store both legacy and new
fingerprints), and (3) make the rewrite optional/explicit (config flag or
migration function) so other plugins' get_xpub() implementations remain
consistent and users get a documented migration path.

---

Nitpick comments:
In `@electrum_dash/plugins/ledger/ledger.py`:
- Around line 227-228: The path-rewrite currently slices bip32_path with
bip32_path[1:], which assumes it starts with "m" and is brittle; change the
rewrite in the branch that checks bip32_path == "m/0'" or bip32_path ==
get_derivation_used_for_hw_device_encryption() to build the new path explicitly
by extracting the suffix after the first "/" (e.g. suffix =
bip32_path.split("/", 1)[1] if "/" in bip32_path else bip32_path) and then set
bip32_path = "m/44'/{coin}'/".format(coin=constants.net.BIP44_COIN_TYPE) +
suffix, referencing bip32_path, get_derivation_used_for_hw_device_encryption(),
and constants.net.BIP44_COIN_TYPE to locate the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce18427f-11be-4666-807b-aa4e866feafa

📥 Commits

Reviewing files that changed from the base of the PR and between 7807e4c and a68a41a.

📒 Files selected for processing (1)
  • electrum_dash/plugins/ledger/ledger.py

Comment thread electrum_dash/plugins/ledger/ledger.py Outdated
@justanwar justanwar merged commit f69eb7f into master Apr 22, 2026
9 checks passed
@justanwar justanwar deleted the ledger_fix branch April 22, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants