Repository navigation
Replace rusqlite with sqlite-thin
#1258
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ jobs: | |
| timeout-minutes: 30 | ||
| strategy: | ||
| matrix: | ||
| # Keep these endpoints in sync with the supported range in Cargo.toml. | ||
| # The oldest release sqlite-thin can share a libsqlite3-sys with, and the newest | ||
| # release line entirely compiling on our MSRV. | ||
| rusqlite: ["0.31.0", "0.39.0"] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also here we could also replace v0.39.0 with v0.40.2 to test the full range available on MSRV |
||
| env: | ||
| CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ default = [ | |
| "chain-esplora", | ||
| "chain-electrum", | ||
| "chain-bitcoind", | ||
| "storage-sqlite", | ||
| "storage-sqlite-bundled", | ||
| "storage-filesystem", | ||
| "storage-vss", | ||
| "unified-payments", | ||
|
|
@@ -52,7 +52,8 @@ chain-electrum = [ | |
| "lightning-transaction-sync/electrum-rustls-ring", | ||
| ] | ||
| chain-bitcoind = ["dep:lightning-block-sync"] | ||
| storage-sqlite = ["dep:rusqlite"] | ||
| storage-sqlite = ["dep:sqlite-thin"] | ||
| storage-sqlite-bundled = ["storage-sqlite", "sqlite-thin/bundled"] | ||
|
Comment on lines
-55
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here i'd prefer to have something like this: storage-sqlite = ["storage-sqlite-system", "sqlite-thin/bundled"]
storage-sqlite-system = ["dep:sqlite-thin"]This keeps something like the same across this PR. Otherwise a user building with this command gets a dynamic link of SQLite, which they never asked for.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Features are new to v0.8, we can freely change them. And the default stays |
||
| storage-filesystem = ["dep:lightning-persister"] | ||
| storage-vss = ["dep:vss-client", "dep:prost"] | ||
| storage-postgres = ["dep:tokio-postgres", "dep:native-tls", "dep:postgres-native-tls"] | ||
|
|
@@ -67,7 +68,7 @@ uniffi-default = [ | |
| "uniffi", | ||
| "chain-esplora", | ||
| "chain-electrum", | ||
| "storage-sqlite", | ||
| "storage-sqlite-bundled", | ||
| "storage-vss", | ||
| "unified-payments", | ||
| ] | ||
|
|
@@ -106,8 +107,7 @@ bdk_wallet = { version = "3.2.0", default-features = false, features = ["std", " | |
|
|
||
| bitreq = { version = "0.3", default-features = false, features = ["async-https", "json-using-serde"] } | ||
| rustls = { version = "0.23", default-features = false, features = ["ring"] } | ||
| # rusqlite 0.40.0 and 0.40.1 do not compile on our MSRV. | ||
| rusqlite = { version = ">=0.31.0, <0.40.0", features = ["bundled"], optional = true } | ||
| sqlite-thin = { version = "0.1.0", optional = true } | ||
| bitcoin = "0.32.7" | ||
| bip39 = { version = "3.0.0", features = ["rand"] } | ||
| bip21 = { version = "0.5", features = ["std"], default-features = false, optional = true } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,7 +77,8 @@ LDK Node's optional dependencies are grouped by the functionality they provide: | |
| | `chain-esplora` | Esplora chain source | | ||
| | `chain-electrum` | Electrum chain source | | ||
| | `chain-bitcoind` | Bitcoin Core RPC and REST chain source | | ||
| | `storage-sqlite` | SQLite storage | | ||
| | `storage-sqlite` | SQLite storage, linking the system's SQLite library | | ||
| | `storage-sqlite-bundled` | SQLite storage, building SQLite from source | | ||
| | `storage-filesystem` | Filesystem storage | | ||
| | `storage-vss` | Versioned Storage Service storage | | ||
| | `storage-postgres` | PostgreSQL storage | | ||
|
|
@@ -87,8 +88,12 @@ LDK Node's optional dependencies are grouped by the functionality they provide: | |
| | `uniffi-default` | The standard language-binding feature set | | ||
|
|
||
| The `default` feature set preserves the native Rust API's previous behavior. It enables all three | ||
| chain sources, SQLite, filesystem and VSS storage, and unified payments. PostgreSQL and UniFFI | ||
| remain opt-in. Every build must enable at least one chain source feature. | ||
| chain sources, bundled SQLite, filesystem and VSS storage, and unified payments. PostgreSQL and | ||
| UniFFI remain opt-in. Every build must enable at least one chain source feature. | ||
|
|
||
| `storage-sqlite` links the SQLite library installed on the system, which hence needs to be | ||
| available at build time and at runtime. Enable `storage-sqlite-bundled` instead to build SQLite from | ||
| source and link it statically, which requires a C compiler. | ||
|
Comment on lines
+94
to
+96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to document here that with dynamic linking, database migrations requires at least SQLite 3.35.0. With 3.34.1, the v1 migration fails. |
||
|
|
||
| On Linux, `storage-postgres` uses the system OpenSSL installation and requires the OpenSSL | ||
| development headers and `pkg-config`. Enable `storage-postgres-vendored-tls` instead to build | ||
|
|
@@ -98,11 +103,12 @@ Disable the default features to select only the functionality and dependencies a | |
| needs. For example: | ||
|
|
||
| ```shell | ||
| cargo build --no-default-features --features chain-esplora,storage-sqlite | ||
| cargo build --no-default-features --features chain-esplora,storage-sqlite-bundled | ||
| ``` | ||
|
|
||
| `uniffi-default` enables UniFFI, Esplora, Electrum, SQLite, VSS, and unified payments. It excludes | ||
| Bitcoin Core, filesystem storage, and PostgreSQL. Binding users can add any of those features: | ||
| `uniffi-default` enables UniFFI, Esplora, Electrum, bundled SQLite, VSS, and unified payments. It | ||
| excludes Bitcoin Core, filesystem storage, and PostgreSQL. Binding users can add any of those | ||
| features: | ||
|
|
||
| ```shell | ||
| cargo build --no-default-features --features uniffi-default,chain-bitcoind | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we could test the fallback mentioned above against an application that only depends on SQLite ldk-node, and does not specify a rustqlite dependency itself. Without the fallback cargo selects libsqlite3-sys 0.40.0 which does not build on MSRV 1.85.