The Problem
Why remove Anchor trait?
We don't need it. Confirmation block and anchor block will be the same block after bitcoindevkit/bdk#1489 is merged.
Anchor representation in TxGraph and tx_graph::ChangeSet is bad
This is how anchors are represented now.
pub struct TxGraph<A = ()> {
anchors: BTreeSet<(A, Txid)>,
// ... OTHER FIELDS
}
pub struct ChangeSet<A = ()> {
pub anchors: BTreeSet<(A, Txid)>,
// ... OTHER FIELDS
}
However, we can have multiple As that have the same anchor block BlockId for the same Txid. This is not ideal. Ideally, we want one anchor per (BlockId, Txid).
The Proposal
pub type Anchor = (Txid, BlockId);
pub struct TxGraph<AM> {
anchors: BTreeMap<Anchor, AM>,
}
pub struct ChangeSet<AM> {
anchors: BTreeMap<Anchor, AM>,
}
Where AM is "anchor metadata". I.e. You can store block time here (u32).
The Problem
Why remove
Anchortrait?We don't need it. Confirmation block and anchor block will be the same block after bitcoindevkit/bdk#1489 is merged.
Anchor representation in
TxGraphandtx_graph::ChangeSetis badThis is how anchors are represented now.
However, we can have multiple
As that have the same anchor blockBlockIdfor the sameTxid. This is not ideal. Ideally, we want one anchor per(BlockId, Txid).The Proposal
Where
AMis "anchor metadata". I.e. You can store block time here (u32).