Skip to content

Commit 9977903

Browse files
committed
Account for lazy being dropped from KVStore::remove
1 parent 351a0a9 commit 9977903

File tree

6 files changed

+43
-58
lines changed

6 files changed

+43
-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: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl KVStore for SqliteStore {
137137
}
138138

139139
fn remove(
140-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
140+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
141141
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
142142
let locking_key = self.build_locking_key(primary_namespace, secondary_namespace, key);
143143
let (inner_lock_ref, version) = self.get_new_version_and_lock_ref(locking_key.clone());
@@ -153,7 +153,6 @@ impl KVStore for SqliteStore {
153153
&primary_namespace,
154154
&secondary_namespace,
155155
&key,
156-
lazy,
157156
)
158157
});
159158
Box::pin(async move {
@@ -206,7 +205,7 @@ impl KVStoreSync for SqliteStore {
206205
}
207206

208207
fn remove(
209-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
208+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
210209
) -> io::Result<()> {
211210
let locking_key = self.build_locking_key(primary_namespace, secondary_namespace, key);
212211
let (inner_lock_ref, version) = self.get_new_version_and_lock_ref(locking_key.clone());
@@ -217,7 +216,6 @@ impl KVStoreSync for SqliteStore {
217216
primary_namespace,
218217
secondary_namespace,
219218
key,
220-
lazy,
221219
)
222220
}
223221

@@ -402,7 +400,7 @@ impl SqliteStoreInner {
402400

403401
fn remove_internal(
404402
&self, inner_lock_ref: Arc<Mutex<u64>>, locking_key: String, version: u64,
405-
primary_namespace: &str, secondary_namespace: &str, key: &str, _lazy: bool,
403+
primary_namespace: &str, secondary_namespace: &str, key: &str,
406404
) -> io::Result<()> {
407405
check_namespace_key_validity(primary_namespace, secondary_namespace, Some(key), "remove")?;
408406

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
@@ -116,7 +116,7 @@ impl KVStoreSync for VssStore {
116116
}
117117

118118
fn remove(
119-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
119+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
120120
) -> io::Result<()> {
121121
let locking_key = self.build_locking_key(primary_namespace, secondary_namespace, key);
122122
let (inner_lock_ref, version) = self.get_new_version_and_lock_ref(locking_key.clone());
@@ -127,7 +127,6 @@ impl KVStoreSync for VssStore {
127127
primary_namespace,
128128
secondary_namespace,
129129
key,
130-
lazy,
131130
);
132131
self.runtime.block_on(fut)
133132
}
@@ -174,7 +173,7 @@ impl KVStore for VssStore {
174173
})
175174
}
176175
fn remove(
177-
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
176+
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
178177
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + Send>> {
179178
let locking_key = self.build_locking_key(primary_namespace, secondary_namespace, key);
180179
let (inner_lock_ref, version) = self.get_new_version_and_lock_ref(locking_key.clone());
@@ -191,7 +190,6 @@ impl KVStore for VssStore {
191190
&primary_namespace,
192191
&secondary_namespace,
193192
&key,
194-
lazy,
195193
)
196194
.await
197195
})
@@ -369,7 +367,7 @@ impl VssStoreInner {
369367

370368
async fn remove_internal(
371369
&self, inner_lock_ref: Arc<tokio::sync::Mutex<u64>>, locking_key: String, version: u64,
372-
primary_namespace: &str, secondary_namespace: &str, key: &str, _lazy: bool,
370+
primary_namespace: &str, secondary_namespace: &str, key: &str,
373371
) -> io::Result<()> {
374372
check_namespace_key_validity(primary_namespace, secondary_namespace, Some(key), "remove")?;
375373

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)