Skip to content

Commit dc63a22

Browse files
committed
Account for lazy being dropped from KVStore::remove
1 parent 51d7551 commit dc63a22

File tree

6 files changed

+45
-58
lines changed

6 files changed

+45
-58
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
@@ -103,7 +103,6 @@ where
103103
&self.primary_namespace,
104104
&self.secondary_namespace,
105105
&store_key,
106-
false,
107106
)
108107
.map_err(|e| {
109108
log_error!(

src/io/sqlite_store/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ impl KVStore for SqliteStore {
9999
})
100100
}
101101
fn remove(
102-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
102+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
103103
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
104104
let primary_namespace = primary_namespace.to_string();
105105
let secondary_namespace = secondary_namespace.to_string();
106106
let key = key.to_string();
107107
let inner = Arc::clone(&self.inner);
108108
let fut = tokio::task::spawn_blocking(move || {
109-
inner.remove_internal(&primary_namespace, &secondary_namespace, &key, lazy)
109+
inner.remove_internal(&primary_namespace, &secondary_namespace, &key)
110110
});
111111
Box::pin(async move {
112112
fut.await.unwrap_or_else(|e| {
@@ -147,9 +147,9 @@ impl KVStoreSync for SqliteStore {
147147
}
148148

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

155155
fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> {
@@ -322,7 +322,7 @@ impl SqliteStoreInner {
322322
}
323323

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

src/io/test_utils.rs

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

58-
kv_store.remove(primary_namespace, secondary_namespace, key, false).unwrap();
58+
kv_store.remove(primary_namespace, secondary_namespace, key).unwrap();
5959

6060
let listed_keys = kv_store.list(primary_namespace, secondary_namespace).unwrap();
6161
assert_eq!(listed_keys.len(), 0);
@@ -71,7 +71,7 @@ pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(
7171
let read_data = kv_store.read(&max_chars, &max_chars, &max_chars).unwrap();
7272
assert_eq!(data, &*read_data);
7373

74-
kv_store.remove(&max_chars, &max_chars, &max_chars, false).unwrap();
74+
kv_store.remove(&max_chars, &max_chars, &max_chars).unwrap();
7575

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

src/io/vss_store.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl KVStoreSync for VssStore {
115115
}
116116

117117
fn remove(
118-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
118+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
119119
) -> io::Result<()> {
120120
let locking_key = self.build_locking_key(primary_namespace, secondary_namespace, key);
121121
let (inner_lock_ref, version) = self.get_new_version_and_lock_ref(locking_key.clone());
@@ -126,7 +126,6 @@ impl KVStoreSync for VssStore {
126126
primary_namespace,
127127
secondary_namespace,
128128
key,
129-
lazy,
130129
);
131130
self.runtime.block_on(fut)
132131
}
@@ -173,7 +172,7 @@ impl KVStore for VssStore {
173172
})
174173
}
175174
fn remove(
176-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
175+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
177176
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
178177
let locking_key = self.build_locking_key(primary_namespace, secondary_namespace, key);
179178
let (inner_lock_ref, version) = self.get_new_version_and_lock_ref(locking_key.clone());
@@ -190,7 +189,6 @@ impl KVStore for VssStore {
190189
&primary_namespace,
191190
&secondary_namespace,
192191
&key,
193-
lazy,
194192
)
195193
.await
196194
})
@@ -368,7 +366,7 @@ impl VssStoreInner {
368366

369367
async fn remove_internal(
370368
&self, inner_lock_ref: Arc<RwLock<u64>>, locking_key: String, version: u64,
371-
primary_namespace: &str, secondary_namespace: &str, key: &str, _lazy: bool,
369+
primary_namespace: &str, secondary_namespace: &str, key: &str,
372370
) -> io::Result<()> {
373371
check_namespace_key_validity(primary_namespace, secondary_namespace, Some(key), "remove")?;
374372

tests/common/mod.rs

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,14 +1240,14 @@ impl KVStore for TestSyncStore {
12401240
})
12411241
}
12421242
fn remove(
1243-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
1243+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
12441244
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
12451245
let primary_namespace = primary_namespace.to_string();
12461246
let secondary_namespace = secondary_namespace.to_string();
12471247
let key = key.to_string();
12481248
let inner = Arc::clone(&self.inner);
12491249
let fut = tokio::task::spawn_blocking(move || {
1250-
inner.remove_internal(&primary_namespace, &secondary_namespace, &key, lazy)
1250+
inner.remove_internal(&primary_namespace, &secondary_namespace, &key)
12511251
});
12521252
Box::pin(async move {
12531253
fut.await.unwrap_or_else(|e| {
@@ -1288,9 +1288,9 @@ impl KVStoreSync for TestSyncStore {
12881288
}
12891289

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

12961296
fn list(
@@ -1428,25 +1428,15 @@ impl TestSyncStoreInner {
14281428
}
14291429

14301430
fn remove_internal(
1431-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
1431+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
14321432
) -> lightning::io::Result<()> {
14331433
let _guard = self.serializer.write().unwrap();
14341434
let fs_res =
1435-
KVStoreSync::remove(&self.fs_store, primary_namespace, secondary_namespace, key, lazy);
1436-
let sqlite_res = KVStoreSync::remove(
1437-
&self.sqlite_store,
1438-
primary_namespace,
1439-
secondary_namespace,
1440-
key,
1441-
lazy,
1442-
);
1443-
let test_res = KVStoreSync::remove(
1444-
&self.test_store,
1445-
primary_namespace,
1446-
secondary_namespace,
1447-
key,
1448-
lazy,
1449-
);
1435+
KVStoreSync::remove(&self.fs_store, primary_namespace, secondary_namespace, key);
1436+
let sqlite_res =
1437+
KVStoreSync::remove(&self.sqlite_store, primary_namespace, secondary_namespace, key);
1438+
let test_res =
1439+
KVStoreSync::remove(&self.test_store, primary_namespace, secondary_namespace, key);
14501440

14511441
assert!(!self
14521442
.do_list(primary_namespace, secondary_namespace)

0 commit comments

Comments
 (0)