Add functions to test persistence#2012
Add functions to test persistence#2012110CodingP wants to merge 2 commits intobitcoindevkit:masterfrom
Conversation
8f06dc6 to
247d478
Compare
247d478 to
83b54a6
Compare
|
I tried re-running CI to no avail, maybe try force pushing. |
83b54a6 to
51d148e
Compare
|
Great idea. ConceptACK |
f2623db to
b77a114
Compare
|
In 10c42dc I added a |
We could have the testenv default feature enable |
|
Should the miniscript feature introduced be removed? I was thinking if some users might not want bdk_chain/miniscript feature to be enabled? |
1eee95b to
fd9429c
Compare
|
|
|
|
notmandatory
left a comment
There was a problem hiding this comment.
Looks good! I made a couple comments and it needs a rebase and then I think it's ready to go.
| let db_tx = db.transaction()?; | ||
| tx_graph::ChangeSet::<ConfirmationBlockTime>::init_sqlite_tables(&db_tx)?; | ||
| let changeset = tx_graph::ChangeSet::<ConfirmationBlockTime>::from_sqlite(&db_tx)?; | ||
| db_tx.commit()?; | ||
| Ok(changeset) |
There was a problem hiding this comment.
Can this be extracted into a function rather than being duplicated?
| let db_tx = db.transaction()?; | ||
| changeset.persist_to_sqlite(&db_tx)?; | ||
| Ok(db_tx.commit()?) |
| last_evicted: [(tx1.compute_txid(), 1755416660)].into(), | ||
| }; | ||
|
|
||
| // persist and load |
There was a problem hiding this comment.
⛏️ Docs should follow the rust style guidelines with first line starts with a capital letter and ends with a period.
https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html
|
I moved this to chain-0.24.0 milestone for visibility, @110CodingP let us know when it's ready for another round of review. |
c4b6873 to
d56cea9
Compare
392160f to
6d1738b
Compare
Added the following functions to test if persistence of `bdk_chain` is happening correctly. - `persist_txgraph_changeset` - `persist_indexer_changeset` - `persist_local_chain_changeset` - `persist_last_seen`, `persist_last_evicted`, `persist_first_seen` - `persist_txouts` - `persist_txs` - `persist_anchors` - `persist_last_revealed` - `persist_spk_cache` Even though the first three tests cover every part of the `ChangeSet`s , the other tests are retained so as to help in unit testing.
6d1738b to
6f09bde
Compare
|
Since we use v13 of |
|
This PR will be important to have if we still want to do #1980 to help test persistence implementations. |
Description
Added basic tests to the testenv for testing custom persistence backends. Partially solves bdk_wallet#14 and might help with bdk_wallet#234.
Notes to the reviewers
An alternative approach could be to create a struct whose methods are these tests but the current approach seems better since these tests are meant to be used as unit tests. For the same reason redundant functions to check persistence of individual fields of the
ChangeSets are provided.Changelog notice
Todo
Checklists
All Submissions:
New Features: