]> Untitled Git - bdk/commit
[chain_redesign] `BlockId` should not implement `Anchor`
author志宇 <hello@evanlinjin.me>
Wed, 3 May 2023 08:03:23 +0000 (16:03 +0800)
committer志宇 <hello@evanlinjin.me>
Fri, 5 May 2023 08:38:29 +0000 (16:38 +0800)
commit2ccc116edabaf59d77324f291a438fc5a8204b3f
tree8921d8ead7339410501c522ca5adfd293f33dd71
parent4ae727a1fb469beacee79fa8d3800152623961eb
[chain_redesign] `BlockId` should not implement `Anchor`

If `BlockId` implements `Anchor`, the meaning is ambiguous. We cannot
tell whether it means the tx is anchors at the block, or whether it also
means the tx is confirmed at that block.

Instead, `ConfirmationHeightAnchor` and `ConfirmationTimeAnchor` structs
are introduced as non-ambiguous `Anchor` implementations.

Additionally, `TxGraph::relevant_heights` is removed because it is also
ambiguous. What heights are deemed relevant? A simpler and more flexible
method `TxGraph::all_anchors` is introduced instead.
crates/chain/src/chain_data.rs
crates/chain/src/tx_graph.rs
crates/chain/tests/test_indexed_tx_graph.rs
crates/chain/tests/test_tx_graph.rs