Skip to content

Commit 6129097

Browse files
committed
Account for lazy being dropped from KVStore::remove
1 parent 7b86727 commit 6129097

File tree

6 files changed

+43
-46
lines changed

6 files changed

+43
-46
lines changed

Cargo.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,29 @@ default = []
5252
#lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
5353
#lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
5454

55-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["std"] }
56-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
57-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["std"] }
58-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
59-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["tokio"] }
60-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
61-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
62-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["rest-client", "rpc-client", "tokio"] }
63-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
64-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
65-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
66-
67-
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
68-
#lightning-types = { path = "../rust-lightning/lightning-types" }
69-
#lightning-invoice = { path = "../rust-lightning/lightning-invoice", features = ["std"] }
70-
#lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
71-
#lightning-persister = { path = "../rust-lightning/lightning-persister", features = ["tokio"] }
72-
#lightning-background-processor = { path = "../rust-lightning/lightning-background-processor" }
73-
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
74-
#lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rest-client", "rpc-client", "tokio"] }
75-
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
76-
#lightning-liquidity = { path = "../rust-lightning/lightning-liquidity", features = ["std"] }
77-
#lightning-macros = { path = "../rust-lightning/lightning-macros" }
55+
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["std"] }
56+
#lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
57+
#lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["std"] }
58+
#lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
59+
#lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["tokio"] }
60+
#lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
61+
#lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
62+
#lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["rest-client", "rpc-client", "tokio"] }
63+
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
64+
#lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
65+
#lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204" }
66+
67+
lightning = { path = "../rust-lightning/lightning", features = ["std"] }
68+
lightning-types = { path = "../rust-lightning/lightning-types" }
69+
lightning-invoice = { path = "../rust-lightning/lightning-invoice", features = ["std"] }
70+
lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" }
71+
lightning-persister = { path = "../rust-lightning/lightning-persister", features = ["tokio"] }
72+
lightning-background-processor = { path = "../rust-lightning/lightning-background-processor" }
73+
lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
74+
lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rest-client", "rpc-client", "tokio"] }
75+
lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
76+
lightning-liquidity = { path = "../rust-lightning/lightning-liquidity", features = ["std"] }
77+
lightning-macros = { path = "../rust-lightning/lightning-macros" }
7878

7979
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
8080
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -109,8 +109,8 @@ winapi = { version = "0.3", features = ["winbase"] }
109109
[dev-dependencies]
110110
#lightning = { version = "0.1.0", features = ["std", "_test_utils"] }
111111
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
112-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["std", "_test_utils"] }
113-
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
112+
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "d0765847c85f1c3dc753c17c3e05dbcb1d300204", features = ["std", "_test_utils"] }
113+
lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
114114
proptest = "1.0.0"
115115
regex = "1.5.6"
116116

src/data_store.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ where
104104
&self.primary_namespace,
105105
&self.secondary_namespace,
106106
&store_key,
107-
false,
108107
)
109108
.map_err(|e| {
110109
log_error!(

src/io/sqlite_store/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ impl KVStore for SqliteStore {
101101
})
102102
}
103103
fn remove(
104-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
104+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
105105
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
106106
let primary_namespace = primary_namespace.to_string();
107107
let secondary_namespace = secondary_namespace.to_string();
108108
let key = key.to_string();
109109
let inner = Arc::clone(&self.inner);
110110
let fut = tokio::task::spawn_blocking(move || {
111-
inner.remove_internal(&primary_namespace, &secondary_namespace, &key, lazy)
111+
inner.remove_internal(&primary_namespace, &secondary_namespace, &key)
112112
});
113113
Box::pin(async move {
114114
fut.await.unwrap_or_else(|e| {
@@ -149,9 +149,9 @@ impl KVStoreSync for SqliteStore {
149149
}
150150

151151
fn remove(
152-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
152+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
153153
) -> io::Result<()> {
154-
self.inner.remove_internal(primary_namespace, secondary_namespace, key, lazy)
154+
self.inner.remove_internal(primary_namespace, secondary_namespace, key)
155155
}
156156

157157
fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> {
@@ -324,7 +324,7 @@ impl SqliteStoreInner {
324324
}
325325

326326
fn remove_internal(
327-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, _lazy: bool,
327+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
328328
) -> io::Result<()> {
329329
check_namespace_key_validity(primary_namespace, secondary_namespace, Some(key), "remove")?;
330330

src/io/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(
5757
let read_data = kv_store.read(primary_namespace, secondary_namespace, key).unwrap();
5858
assert_eq!(data, &*read_data);
5959

60-
kv_store.remove(primary_namespace, secondary_namespace, key, false).unwrap();
60+
kv_store.remove(primary_namespace, secondary_namespace, key).unwrap();
6161

6262
let listed_keys = kv_store.list(primary_namespace, secondary_namespace).unwrap();
6363
assert_eq!(listed_keys.len(), 0);
@@ -73,7 +73,7 @@ pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(
7373
let read_data = kv_store.read(&max_chars, &max_chars, &max_chars).unwrap();
7474
assert_eq!(data, &*read_data);
7575

76-
kv_store.remove(&max_chars, &max_chars, &max_chars, false).unwrap();
76+
kv_store.remove(&max_chars, &max_chars, &max_chars).unwrap();
7777

7878
let listed_keys = kv_store.list(&max_chars, &max_chars).unwrap();
7979
assert_eq!(listed_keys.len(), 0);

src/io/vss_store.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ impl KVStoreSync for VssStore {
7474
}
7575

7676
fn remove(
77-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
77+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
7878
) -> io::Result<()> {
79-
let fut = self.inner.remove_internal(primary_namespace, secondary_namespace, key, lazy);
79+
let fut = self.inner.remove_internal(primary_namespace, secondary_namespace, key);
8080
self.runtime.block_on(fut)
8181
}
8282

@@ -110,14 +110,14 @@ impl KVStore for VssStore {
110110
})
111111
}
112112
fn remove(
113-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
113+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
114114
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
115115
let primary_namespace = primary_namespace.to_string();
116116
let secondary_namespace = secondary_namespace.to_string();
117117
let key = key.to_string();
118118
let inner = Arc::clone(&self.inner);
119119
Box::pin(async move {
120-
inner.remove_internal(&primary_namespace, &secondary_namespace, &key, lazy).await
120+
inner.remove_internal(&primary_namespace, &secondary_namespace, &key).await
121121
})
122122
}
123123
fn list(
@@ -277,7 +277,7 @@ impl VssStoreInner {
277277
}
278278

279279
async fn remove_internal(
280-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, _lazy: bool,
280+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
281281
) -> io::Result<()> {
282282
check_namespace_key_validity(primary_namespace, secondary_namespace, Some(key), "remove")?;
283283
let request = DeleteObjectRequest {

tests/common/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,14 +1238,14 @@ impl KVStore for TestSyncStore {
12381238
})
12391239
}
12401240
fn remove(
1241-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
1241+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
12421242
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
12431243
let primary_namespace = primary_namespace.to_string();
12441244
let secondary_namespace = secondary_namespace.to_string();
12451245
let key = key.to_string();
12461246
let inner = Arc::clone(&self.inner);
12471247
let fut = tokio::task::spawn_blocking(move || {
1248-
inner.remove_internal(&primary_namespace, &secondary_namespace, &key, lazy)
1248+
inner.remove_internal(&primary_namespace, &secondary_namespace, &key)
12491249
});
12501250
Box::pin(async move {
12511251
fut.await.unwrap_or_else(|e| {
@@ -1286,9 +1286,9 @@ impl KVStoreSync for TestSyncStore {
12861286
}
12871287

12881288
fn remove(
1289-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
1289+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
12901290
) -> lightning::io::Result<()> {
1291-
self.inner.remove_internal(primary_namespace, secondary_namespace, key, lazy)
1291+
self.inner.remove_internal(primary_namespace, secondary_namespace, key)
12921292
}
12931293

12941294
fn list(
@@ -1426,24 +1426,22 @@ impl TestSyncStoreInner {
14261426
}
14271427

14281428
fn remove_internal(
1429-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
1429+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
14301430
) -> lightning::io::Result<()> {
14311431
let _guard = self.serializer.write().unwrap();
14321432
let fs_res =
1433-
KVStoreSync::remove(&self.fs_store, primary_namespace, secondary_namespace, key, lazy);
1433+
KVStoreSync::remove(&self.fs_store, primary_namespace, secondary_namespace, key);
14341434
let sqlite_res = KVStoreSync::remove(
14351435
&self.sqlite_store,
14361436
primary_namespace,
14371437
secondary_namespace,
14381438
key,
1439-
lazy,
14401439
);
14411440
let test_res = KVStoreSync::remove(
14421441
&self.test_store,
14431442
primary_namespace,
14441443
secondary_namespace,
14451444
key,
1446-
lazy,
14471445
);
14481446

14491447
assert!(!self

0 commit comments

Comments
 (0)