Description
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 A
s 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
).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Progress