From eb5f5b5f9e4eaa5532eb8b5a32df6b3a8869eaa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=97=E5=AE=87?= Date: Sat, 27 Jun 2026 07:16:25 +0000 Subject: [PATCH] fix(wallet): map keychain in mark_used and unmark_used `mark_used` and `unmark_used` passed the caller-supplied `KeychainKind` straight to the index. For single-descriptor wallets, this meant marking or unmarking an index on `Internal` was a no-op, since that wallet only tracks the `External` keychain. Route the keychain through `map_keychain` first, consistent with the other methods that take a `KeychainKind`, so a single-keychain wallet resolves `Internal` to `External`. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/wallet/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 60d1ccef..5b51d43b 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -729,7 +729,9 @@ impl Wallet { /// /// Returns whether the given index was present and then removed from the unused set. pub fn mark_used(&mut self, keychain: KeychainKind, index: u32) -> bool { - self.tx_graph.index.mark_used(keychain, index) + self.tx_graph + .index + .mark_used(self.map_keychain(keychain), index) } /// Undoes the effect of [`mark_used`] and returns whether the `index` was inserted @@ -741,7 +743,9 @@ impl Wallet { /// /// [`mark_used`]: Self::mark_used pub fn unmark_used(&mut self, keychain: KeychainKind, index: u32) -> bool { - self.tx_graph.index.unmark_used(keychain, index) + self.tx_graph + .index + .unmark_used(self.map_keychain(keychain), index) } /// List addresses that are revealed but unused.