Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added wallet name to persister #12

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1adf63c
fix(example_cli): add bitcoin and rand dependencies
notmandatory Aug 12, 2024
3675a9e
ci: add job to build example-crates independently
notmandatory Aug 12, 2024
cad3533
feat(esplora): make ext traits more flexible
evanlinjin Jun 16, 2024
c93e6fd
feat(esplora): always fetch prevouts
evanlinjin Jul 2, 2024
16c1c2c
docs(esplora): Simplify crate docs
evanlinjin Jul 21, 2024
44e2a79
feat!: rework `FullScanRequest` and `SyncRequest`
evanlinjin Aug 1, 2024
38f86fe
fix: no premature collect
evanlinjin Aug 2, 2024
0234f70
docs(esplora): Fix typo
evanlinjin Aug 3, 2024
96023c0
docs(chain): improve `SyncRequestBuilder::spks_with_labels` docs
evanlinjin Aug 12, 2024
3eb5dd1
fix(chain): correct `Iterator::size_hint` impl
evanlinjin Aug 12, 2024
584b10a
docs(esplora): README example, uncomment async import
evanlinjin Aug 12, 2024
6d77e2e
refactor(chain)!: Rename `spks_with_labels` to `spks_with_indices`
evanlinjin Aug 13, 2024
cc84872
Merge bitcoindevkit/bdk#1478: Allow opting out of getting `LocalChain…
notmandatory Aug 14, 2024
2391b76
refactor(wallet)!: rename LoadParams methods
thunderbiscuit Aug 6, 2024
9695296
Merge bitcoindevkit/bdk#1537: Use explicit names for wallet builder m…
notmandatory Aug 14, 2024
e0822d7
Merge bitcoindevkit/bdk#1549: fix(example_cli): add bitcoin and rand …
notmandatory Aug 14, 2024
039622f
feat(wallet)!: introduce `WalletPersister`
evanlinjin Aug 9, 2024
06a9d6c
feat(chain,wallet)!: publicize `.init_sqlite_tables` changeset methods
evanlinjin Aug 11, 2024
a9c5f76
feat(wallet)!: remove dependency on `bdk_chain::Staged`
evanlinjin Aug 11, 2024
0616057
revert(chain)!: rm `persit` module
evanlinjin Aug 11, 2024
9600293
feat(wallet)!: add persister (`P`) type param to `PersistedWallet<P>`
evanlinjin Aug 15, 2024
f434c93
docs(wallet): fixes/improvements for `persisted` and `params` types
evanlinjin Aug 16, 2024
c7464b1
added wallet name as argument to async wallet persister
matthiasdebernardini Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,32 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings

build-examples:
name: Build Examples
runs-on: ubuntu-latest
strategy:
matrix:
example-dir:
- example_cli
- example_bitcoind_rpc_polling
- example_electrum
- example_esplora
- wallet_electrum
- wallet_esplora_async
- wallet_esplora_blocking
- wallet_rpc
steps:
- name: checkout
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Build
working-directory: example-crates/${{ matrix.example-dir }}
run: cargo build
2 changes: 0 additions & 2 deletions crates/chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ pub use tx_data_traits::*;
pub use tx_graph::TxGraph;
mod chain_oracle;
pub use chain_oracle::*;
mod persist;
pub use persist::*;

#[doc(hidden)]
pub mod example_utils;
Expand Down
169 changes: 0 additions & 169 deletions crates/chain/src/persist.rs

This file was deleted.

30 changes: 15 additions & 15 deletions crates/chain/src/rusqlite_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ where
pub const ANCHORS_TABLE_NAME: &'static str = "bdk_anchors";

/// Initialize sqlite tables.
fn init_sqlite_tables(db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
pub fn init_sqlite_tables(db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
let schema_v0: &[&str] = &[
// full transactions
&format!(
Expand Down Expand Up @@ -264,9 +264,9 @@ where
}

/// Construct a [`TxGraph`] from an sqlite database.
///
/// Remember to call [`Self::init_sqlite_tables`] beforehand.
pub fn from_sqlite(db_tx: &rusqlite::Transaction) -> rusqlite::Result<Self> {
Self::init_sqlite_tables(db_tx)?;

let mut changeset = Self::default();

let mut statement = db_tx.prepare(&format!(
Expand Down Expand Up @@ -332,9 +332,9 @@ where
}

/// Persist `changeset` to the sqlite database.
///
/// Remember to call [`Self::init_sqlite_tables`] beforehand.
pub fn persist_to_sqlite(&self, db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
Self::init_sqlite_tables(db_tx)?;

let mut statement = db_tx.prepare_cached(&format!(
"INSERT INTO {}(txid, raw_tx) VALUES(:txid, :raw_tx) ON CONFLICT(txid) DO UPDATE SET raw_tx=:raw_tx",
Self::TXS_TABLE_NAME,
Expand Down Expand Up @@ -396,7 +396,7 @@ impl local_chain::ChangeSet {
pub const BLOCKS_TABLE_NAME: &'static str = "bdk_blocks";

/// Initialize sqlite tables for persisting [`local_chain::LocalChain`].
fn init_sqlite_tables(db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
pub fn init_sqlite_tables(db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
let schema_v0: &[&str] = &[
// blocks
&format!(
Expand All @@ -411,9 +411,9 @@ impl local_chain::ChangeSet {
}

/// Construct a [`LocalChain`](local_chain::LocalChain) from sqlite database.
///
/// Remember to call [`Self::init_sqlite_tables`] beforehand.
pub fn from_sqlite(db_tx: &rusqlite::Transaction) -> rusqlite::Result<Self> {
Self::init_sqlite_tables(db_tx)?;

let mut changeset = Self::default();

let mut statement = db_tx.prepare(&format!(
Expand All @@ -435,9 +435,9 @@ impl local_chain::ChangeSet {
}

/// Persist `changeset` to the sqlite database.
///
/// Remember to call [`Self::init_sqlite_tables`] beforehand.
pub fn persist_to_sqlite(&self, db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
Self::init_sqlite_tables(db_tx)?;

let mut replace_statement = db_tx.prepare_cached(&format!(
"REPLACE INTO {}(block_height, block_hash) VALUES(:block_height, :block_hash)",
Self::BLOCKS_TABLE_NAME,
Expand Down Expand Up @@ -471,7 +471,7 @@ impl keychain_txout::ChangeSet {

/// Initialize sqlite tables for persisting
/// [`KeychainTxOutIndex`](keychain_txout::KeychainTxOutIndex).
fn init_sqlite_tables(db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
pub fn init_sqlite_tables(db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
let schema_v0: &[&str] = &[
// last revealed
&format!(
Expand All @@ -487,9 +487,9 @@ impl keychain_txout::ChangeSet {

/// Construct [`KeychainTxOutIndex`](keychain_txout::KeychainTxOutIndex) from sqlite database
/// and given parameters.
///
/// Remember to call [`Self::init_sqlite_tables`] beforehand.
pub fn from_sqlite(db_tx: &rusqlite::Transaction) -> rusqlite::Result<Self> {
Self::init_sqlite_tables(db_tx)?;

let mut changeset = Self::default();

let mut statement = db_tx.prepare(&format!(
Expand All @@ -511,9 +511,9 @@ impl keychain_txout::ChangeSet {
}

/// Persist `changeset` to the sqlite database.
///
/// Remember to call [`Self::init_sqlite_tables`] beforehand.
pub fn persist_to_sqlite(&self, db_tx: &rusqlite::Transaction) -> rusqlite::Result<()> {
Self::init_sqlite_tables(db_tx)?;

let mut statement = db_tx.prepare_cached(&format!(
"REPLACE INTO {}(descriptor_id, last_revealed) VALUES(:descriptor_id, :last_revealed)",
Self::LAST_REVEALED_TABLE_NAME,
Expand Down
Loading