Skip to content

Commit

Permalink
doc: Clarification for multiple K same descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabrozzoni committed May 8, 2024
1 parent 33fe84f commit 078a932
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crates/chain/src/keychain/txout_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ const DEFAULT_LOOKAHEAD: u32 = 25;
/// this is useful in case a user unassigns a keychain from a descriptor and after some time
/// assigns it again.
///
/// Additionally, although a keychain can only be assigned to one descriptor, different keychains
/// can be assigned to the same descriptor. When a method returns spks/outpoints that is associated
/// with a descriptor, it may be associated with multiple keychain variants. The keychain variant
/// with the higher rank will be returned. Rank is determined by the [`Ord`] implementation of the
/// keychain type. Earlier keychain variants have higher rank.
/// # Different keychains assigned to one descriptor
///
/// Although a keychain can only be assigned to one descriptor, different keychains
/// can be assigned to the same descriptor. This is not recommended.
///
/// If multiple keycahins are assigned to the same descriptor:
/// 1. Methods that take in a keychain, such as [`KeychainTxOutIndex::reveal_next_spk`],
/// will work normally when either keychain is passed in.
/// 2. Methods that return a keychain, such as [`KeychainTxOutIndex::outpoints`] will
/// return only the keychain variant with the highest rank.
/// Rank is determined by the [`Ord`] implementation of the keychain type.
///
/// [`Ord`]: core::cmp::Ord
/// [`SpkTxOutIndex`]: crate::spk_txout_index::SpkTxOutIndex
Expand Down

0 comments on commit 078a932

Please sign in to comment.