bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Expand the `KeychainTxOutIndex::inner` docs to provide usage examples

Open danielabrozzoni opened this issue 1 year ago • 2 comments

See https://github.com/bitcoindevkit/bdk/pull/1203#discussion_r1491860268

danielabrozzoni avatar Feb 19 '24 15:02 danielabrozzoni

@evanlinjin I'm thinking of just removing the KeychainTxOutIndex::inner method from the public interface. I see that it is used in test_keychain_txout_index.rs mainly for the purpose of getting the total count of indexed spks from the inner index. Is there a reason a user might need that information? If not, a simple solution is to move a few tests to unit tests in keychain_txout module. Alternatively there could be another way to express the same idea using the existing APIs, or similarly exposing SpkTxOutIndex::all_spks for KeychainTxOutIndex. Curious if you have an opinion.

ValuedMammal avatar Oct 16 '24 16:10 ValuedMammal

@ValuedMammal my only argument for keeping it is that you can use it to explore lookahead spks. However, you can also use the unbounded.. iterator methods on KeychainTxOutIndex.

Since it's mentioned to be a potential footgun (since it includes lookahead spks), maybe we should remove it? If we need a certain functionality later on, we can add it then.

evanlinjin avatar Oct 17 '24 07:10 evanlinjin