refactor(chain)!: Remove `Anchor` trait and make anchors unique to (Txid, BlockId)
Resolves bitcoindevkit/bdk_wallet#90.
Description
The Anchor trait has been removed and anchors are now unique to (Txid, BlockId).
Notes to the reviewers
Documentation have been mostly untouched and need to be written/updated.
Changelog notice
Anchortrait has been removed.Anchortype andBlockTimestruct have been added tobdk_chain.
Checklists
All Submissions:
- [x] I've signed all my commits
- [x] I followed the contribution guidelines
- [x] I ran
cargo fmtandcargo clippybefore committing
@notmandatory I prefer we rebase this on top of bitcoindevkit/bdk#1514 since that PR is more "final" than this one.
As discussed privately, it makes sense to rm TxGraph::anchors field.
pub struct TxGraph<AM = BlockTime> {
// all transactions that the graph is aware of in format: `(tx_node, tx_anchors)`
txs: HashMap<Txid, (TxNodeInternal, BTreeMap<BlockId, AM>)>,
spends: BTreeMap<OutPoint, HashSet<Txid>>,
last_seen: HashMap<Txid, u64>,
// This atrocity exists so that `TxGraph::outspends()` can return a reference.
// FIXME: This can be removed once `HashSet::new` is a const fn.
empty_outspends: HashSet<Txid>,
}
See P.O.C: https://github.com/bitcoindevkit/bdk/commit/63d9e6a8973e0657ab6d9d9eadac8e544c15125c
This is great work. However, we have concluded that we do not have enough time to get this into v1.0.beta (as discussed).
I'll move this out of the alpha milestone, thanks guys.
Technically wallet ChangeSet is part of the public wallet API I'll move this to 2.0.