Commit f2e7a78
committed
Merge bitcoindevkit#2135: docs: Document TxUpdate temporal context requirements (supports Wizardsardine audit recommendation)
b69d7bf docs: document TxUpdate temporal context requirements (Rafael Turon)
Pull request description:
Closes bitcoindevkit#2133
This introduces clear temporal context **documentation** to the `TxUpdate` struct, explicitly stating that entries must have either `anchors` or `seen_ats` to be considered canonical and contribute to wallet balances.
It also explicitly documents the `seen_ats` HashSet signature to prevent usage errors when writing custom chain sources.
This fulfills the recommendation outlined in the Wizardsardine BDK Audit Report (Q4 2024).
### Description
This primarily affects developers building **custom chain sources** — anyone constructing `Update` structs outside of `bdk_electrum`/`bdk_esplora`/`bdk_bitcoind_rpc`.
As the ecosystem grows (streaming Electrum, Nostr relay sync, compact block filters, custom backends), more developers will encounter this undocumented contract.
### What I Changed
*1. Doc comment on `TxUpdate` struct*
* **`anchors` or `seen_ats`** are stored in the graph but do not affect the balance.
* **`seen_ats` collection type**: `TxUpdate::seen_ats` is a `BTreeSet<(Txid, u64)>`, requiring `.insert((txid, timestamp))`.
*2. Doc comment on `Wallet::apply_update()`*
* **TxGraph `apply_update`**: transactions without temporal context note.
* **IndexedTxGraph `apply_update`**: transactions without temporal context note.
### Impact
This is just a documentation fix - no code changes, no breaking changes.
### Checklists
#### All Submissions:
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
ACKs for top commit:
evanlinjin:
ACK b69d7bf
Tree-SHA512: 669fbd2c23f7615c697d550ab448b3fd72955223cef4146d6719e2d0c26b959253ce987eebf737366968cb88e5477a897289274ddf78c1ffd338be4e5d795f4b3 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
915 | 918 | | |
916 | 919 | | |
917 | 920 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
0 commit comments