Skip to content

Commit 8cdca11

Browse files
authored
Initial payment store implementation (#13)
* Add inital implementation of persisted payment store * Implement `KVStoreUnpersister` * Reorganize IO things into `io` submodules * Reorganize test folder for consistency * Move test `bitcoind`/`electrsd` out of `OnceCell` `OnceCell` doesn't call `drop`, which makes the spawned `bitcoind`/`electrsd` instances linger around after our tests have finished. To fix this, we move them out of `OnceCell` and let every test that needs them spawn their own instances. This additional let us drop the `OnceCell` dev dependency. Additionally, we improve the test robustness by applying most of the changes from lightningdevkit/rust-lightning#2033. * Introduce `KVStore` trait and `FilesystemStore` impl Rather than further relying on the upstream `KVStorePersister`/`KVStoreUnpersister`, we here implement a general `KVStore` trait that allows access to `Read`s/`TransactionalWrite`s which may be used to deserialize/serialize data via the `Readable`/`Writeable` implementations. Notably `TransactionalWrite` is a `Write` for which the written data needs to be explictly `commit`ed, asserting that we always persist either the whole new change or no change at all. Additionally, we avoid the `Info` umbrella term but opt to introduce `PaymentDetails` to align naming with upcoming `PeerDetails` and `ChannelDetails`. * Unpin BDK/esplora-client
1 parent 6aa4a86 commit 8cdca11

14 files changed

+1857
-620
lines changed

Cargo.toml

+4-11
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ lightning-background-processor = { git = "https://github.com/lightningdevkit/rus
3333
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518" }
3434
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev="7b85ebadb64058127350b83fb4b76dcb409ea518", features = ["esplora-async"] }
3535

36-
#lightning = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common", features = ["max_level_trace", "std"] }
37-
#lightning-invoice = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common" }
38-
#lightning-net-tokio = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common" }
39-
#lightning-persister = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common" }
40-
#lightning-background-processor = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common" }
41-
#lightning-rapid-gossip-sync = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common" }
42-
#lightning-transaction-sync = { git = "https://github.com/tnull/rust-lightning", branch="2023-03-expose-impl-writeable-tlv-based-enum-common", features = ["esplora-async"] }
43-
4436
#lightning = { path = "../rust-lightning/lightning", features = ["max_level_trace", "std"] }
4537
#lightning-invoice = { path = "../rust-lightning/lightning-invoice" }
4638
#lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
@@ -49,7 +41,7 @@ lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-li
4941
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
5042
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async"] }
5143

52-
bdk = { version = "=0.27.1", default-features = false, features = ["async-interface", "use-esplora-async", "sqlite-bundled"]}
44+
bdk = { version = "0.27.1", default-features = false, features = ["async-interface", "use-esplora-async", "sqlite-bundled"]}
5345
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
5446
rusqlite = { version = "0.28.0", features = ["bundled"] }
5547
bitcoin = "0.29.2"
@@ -59,13 +51,14 @@ chrono = "0.4"
5951
futures = "0.3"
6052
serde_json = { version = "1.0" }
6153
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "sync" ] }
62-
esplora-client = { version = "=0.3", default-features = false }
54+
esplora-client = { version = "0.4", default-features = false }
55+
libc = "0.2"
6356

6457
[dev-dependencies]
6558
electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] }
6659
electrum-client = "0.12.0"
67-
once_cell = "1.16.0"
6860
proptest = "1.0.0"
61+
regex = "1.5.6"
6962

7063
[profile.release]
7164
panic = "abort"

0 commit comments

Comments
 (0)