LLFourn / bdk_core_staging

Staging area for bdk_core initial development
15 stars 12 forks source link

KeychainTxOutIndex should look ahead #163

Closed LLFourn closed 1 year ago

LLFourn commented 1 year ago

Doing "stop gap" like logic when scanning through blocks is annoying with the current API because we conflate with the "index which I will give out next address I will give out" with the "index I derive scripts up to so I can find outputs for them". Just like bdk already does we can have a kind of look ahead to make this easier.

The API should be:

Then the KeychainTxOutIndex should just make sure that it is has always inserted lookahead more spks into the inner SpkTxOutIndex. scan will also need to return the updated DerivationAdditions for each call since now scannig can increase your derivation index.

We can also remove store_* methods from the API and rebrand them to set_derivation_index which should also return a DerivationAdditions.