refactor(keychain): Fix KeychainTxOutIndex range queries

The underlying SpkTxOutIndex should not use DescriptorIds to index
because this loses the ordering relationship of the spks so queries on
subranges of keychains work.

Along with that we enforce that there is a strict 1-to-1 relationship
between descriptors and keychains. Violating this leads to an error in
insert_descriptor now.

In general I try to make the translation layer between the SpkTxOutIndex
and the KeychainTxOutIndex thinner. Ergonomics of this will be improved
in next commit.

The test from the previous commit passes.
This commit is contained in:
LLFourn authored and 志宇 committed 2024-06-13 22:52:43 +08:00
1 parent 3b2ff0cc95
commit bc2a8be979
12 files changed
+441 -467

No files matched your search

@@ -212,7 +212,7 @@ fn main() -> anyhow::Result<()> {
graph.graph().balance(
&*chain,
synced_to.block_id(),
graph.index.outpoints(),
graph.index.outpoints().iter().cloned(),
|(k, _), _| k == &Keychain::Internal,
)
};
@@ -336,7 +336,7 @@ fn main() -> anyhow::Result<()> {
graph.graph().balance(
&*chain,
synced_to.block_id(),
graph.index.outpoints(),
graph.index.outpoints().iter().cloned(),
|(k, _), _| k == &Keychain::Internal,
)
};