bdk icon indicating copy to clipboard operation
bdk copied to clipboard

KeychainTxOutIndex method should behave consistently when non-existent keychains are passed in as arguments

Open danielabrozzoni opened this issue 1 year ago • 2 comments

Some KeychainTxOutIndex methods panic if a non-existent keychain is passed in as an argument. Some examples include:

  • unbounded_spk_iter
  • next_index

Instead, the methods that return an iterator simply return an empty one. Some examples are:

  • keychain_outpoints
  • unused_keychain_spks

I think we should be consistent, and either panic everywhere, or return a Result/Option everywhere. I personally don't like returning empty iterators, as the mistake of passing a non-existent keychain might be overlooked.

More discussion here: https://github.com/bitcoindevkit/bdk/pull/1203#discussion_r1474319073

danielabrozzoni avatar Feb 12 '24 18:02 danielabrozzoni

Can I work on this? Although I will need some briefing

c0llinx avatar Apr 04 '24 19:04 c0llinx

starting work on this will need to wait until #1203 is merged.

LLFourn avatar Apr 05 '24 11:04 LLFourn

Looks like this was also fixed in #1203.

notmandatory avatar Aug 22 '24 21:08 notmandatory