Open evanlinjin opened 8 months ago
Let me try this.
How does this line even compile:
If unconf_anchor
isn't even an Anchor
how can you pass it to insert_anchor
!?!?!?
If
unconf_anchor
isn't even anAnchor
how can you pass it toinsert_anchor
!?!?!?
We will remove Anchor
implementation for ChainPosition<A>
to avoid the caller using UnconfirmChainPosition(u64)
as an anchor to avoid malusage.
How does this line even compile:
If
unconf_anchor
isn't even anAnchor
how can you pass it toinsert_anchor
!?!?!?
We aren't enforcing the A: Anchor
bound on that method. Now the question is, should we? What should be the policy of how we do generic bounds? I tend to avoid them wherever possible because bounds stack and it becomes annoying to deal with at higher levels.
If
unconf_anchor
isn't even anAnchor
how can you pass it toinsert_anchor
!?!?!?We will remove
Anchor
implementation forChainPosition<A>
to avoid the caller usingUnconfirmChainPosition(u64)
as an anchor to avoid malusage.
There is no Anchor
implementation for ChainPosition
. https://github.com/bitcoindevkit/bdk/pull/1338#discussion_r1485538692
yeh, I misread it.
Describe the bug
https://github.com/bitcoindevkit/bdk/blob/7aca88474ac241bc0938ff989026463bdaf8f3ab/crates/chain/tests/test_tx_graph.rs#L16-L17
This test misunderstands
Anchor
s. There is no such thing as an "unconfirmed anchor", andChainPosition
does not implementAnchor
. We should rewrite this test to be comprehensive.Proposed test scenarios
A
, then insert partial txout(s) of the same txid. Expect: No changes toTxGraph
(full tx should still exist in graph). Returned changeset is empty.B
. Then insert full tx with txidB
. Expect: the full tx should replace the partial tx. Check graph and returned changeset to confirm this.