Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&self.0,
primary_namespace,
Expand Down
3 changes: 2 additions & 1 deletion src/chain/bitcoind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,8 @@ impl BlockSource for BitcoindClient {

fn get_best_block<'a>(
&'a self,
) -> impl Future<Output = Result<(bitcoin::BlockHash, Option<u32>), BlockSourceError>> + 'a {
) -> impl Future<Output = Result<(bitcoin::BlockHash, Option<u32>), BlockSourceError>> + 'a
{
async move {
match self {
BitcoindClient::Rpc { rpc_client, .. } => rpc_client.get_best_block().await,
Expand Down
30 changes: 20 additions & 10 deletions src/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ mod tests {
impl KVStore for FailingStore {
fn read(
&self, _primary_namespace: &str, _secondary_namespace: &str, _key: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send
{
async { Err(io::Error::new(io::ErrorKind::Other, "read failed")) }
}

Expand All @@ -938,7 +939,8 @@ mod tests {

fn list(
&self, _primary_namespace: &str, _secondary_namespace: &str,
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send
{
async { Err(io::Error::new(io::ErrorKind::Other, "list failed")) }
}
}
Expand Down Expand Up @@ -979,7 +981,8 @@ mod tests {
impl KVStore for GatedStore {
fn read(
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send
{
self.inner.read(primary_namespace, secondary_namespace, key)
}

Expand All @@ -1004,7 +1007,8 @@ mod tests {

fn list(
&self, primary_namespace: &str, secondary_namespace: &str,
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send
{
self.inner.list(primary_namespace, secondary_namespace)
}
}
Expand Down Expand Up @@ -1358,7 +1362,8 @@ mod tests {
impl KVStore for CountingStore {
fn read(
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send
{
self.reads.fetch_add(1, Ordering::Relaxed);
self.inner.read(primary_namespace, secondary_namespace, key)
}
Expand All @@ -1379,7 +1384,8 @@ mod tests {

fn list(
&self, primary_namespace: &str, secondary_namespace: &str,
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send
{
self.lists.fetch_add(1, Ordering::Relaxed);
self.inner.list(primary_namespace, secondary_namespace)
}
Expand Down Expand Up @@ -1408,7 +1414,8 @@ mod tests {
impl KVStore for WriteFailingStore {
fn read(
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send
{
self.inner.read(primary_namespace, secondary_namespace, key)
}

Expand Down Expand Up @@ -1440,7 +1447,8 @@ mod tests {

fn list(
&self, primary_namespace: &str, secondary_namespace: &str,
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send
{
self.inner.list(primary_namespace, secondary_namespace)
}
}
Expand Down Expand Up @@ -1858,7 +1866,8 @@ mod tests {
impl KVStore for PhantomKeyStore {
fn read(
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send
{
self.inner.read(primary_namespace, secondary_namespace, key)
}

Expand All @@ -1876,7 +1885,8 @@ mod tests {

fn list(
&self, primary_namespace: &str, secondary_namespace: &str,
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send
{
self.inner.list(primary_namespace, secondary_namespace)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/io/in_memory_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ impl PaginatedKVStore for InMemoryStore {
impl MigratableKVStore for InMemoryStore {
fn list_all_keys(
&self,
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send
{
let res = self.list_all_keys_internal();
async move { res }
}
Expand Down
3 changes: 2 additions & 1 deletion src/io/postgres_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ impl PaginatedKVStore for PostgresStore {
impl MigratableKVStore for PostgresStore {
fn list_all_keys(
&self,
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send
{
let inner = Arc::clone(&self.inner);
let runtime = self.internal_runtime();
async move {
Expand Down
3 changes: 2 additions & 1 deletion src/io/sqlite_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ impl PaginatedKVStore for SqliteStore {
impl MigratableKVStore for SqliteStore {
fn list_all_keys(
&self,
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send
{
let inner = Arc::clone(&self.inner);
let fut = tokio::task::spawn_blocking(move || inner.list_all_keys_internal());
async move {
Expand Down
3 changes: 2 additions & 1 deletion src/io/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ pub(crate) fn read_or_generate_seed_file(
}

#[cfg(unix)]
let mut f = OpenOptions::new().write(true).create_new(true).mode(0o400).open(keys_seed_path)?;
let mut f =
OpenOptions::new().write(true).create_new(true).mode(0o400).open(keys_seed_path)?;

#[cfg(not(unix))]
let mut f = OpenOptions::new().write(true).create_new(true).open(keys_seed_path)?;
Expand Down
3 changes: 2 additions & 1 deletion src/io/vss_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ impl PaginatedKVStore for VssStore {
impl MigratableKVStore for VssStore {
fn list_all_keys(
&self,
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<Vec<(String, String, String)>, io::Error>> + 'static + Send
{
let inner = Arc::clone(&self.inner);
let runtime = self.internal_runtime();
async move {
Expand Down
16 changes: 7 additions & 9 deletions src/payment/asynchronous/static_invoice_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ impl StaticInvoiceStore {
)
})
})
.or_else(
|e| {
if e.kind() == lightning::io::ErrorKind::NotFound {
Ok(None)
} else {
Err(e)
}
},
)
.or_else(|e| {
if e.kind() == lightning::io::ErrorKind::NotFound {
Ok(None)
} else {
Err(e)
}
})
}

pub(crate) async fn handle_persist_static_invoice(
Expand Down
6 changes: 4 additions & 2 deletions src/peer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ mod tests {
impl KVStore for FailingStore {
fn read(
&self, _primary_namespace: &str, _secondary_namespace: &str, _key: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send
{
async { Err(io::Error::new(io::ErrorKind::Other, "read failed")) }
}

Expand All @@ -204,7 +205,8 @@ mod tests {

fn list(
&self, _primary_namespace: &str, _secondary_namespace: &str,
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send {
) -> impl std::future::Future<Output = Result<Vec<String>, io::Error>> + 'static + Send
{
async { Err(io::Error::new(io::ErrorKind::Other, "list failed")) }
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ impl<'a> KVStore for dyn DynStoreTrait + 'a {
impl<'a> PaginatedKVStore for dyn DynStoreTrait + 'a {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str, page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, bitcoin::io::Error>> + Send + 'static {
) -> impl Future<Output = Result<PaginatedListResponse, bitcoin::io::Error>> + Send + 'static
{
DynStoreTrait::list_paginated_async(
self,
primary_namespace,
Expand Down Expand Up @@ -153,7 +154,8 @@ impl KVStore for DynStoreRef {
impl PaginatedKVStore for DynStoreRef {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str, page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, bitcoin::io::Error>> + Send + 'static {
) -> impl Future<Output = Result<PaginatedListResponse, bitcoin::io::Error>> + Send + 'static
{
DynStoreTrait::list_paginated_async(
&*self.0,
primary_namespace,
Expand Down Expand Up @@ -186,7 +188,8 @@ impl<T: PaginatedKVStore + Send + Sync> DynStoreTrait for DynStoreWrapper<T> {

fn list_async(
&self, primary_namespace: &str, secondary_namespace: &str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, bitcoin::io::Error>> + Send + 'static>> {
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, bitcoin::io::Error>> + Send + 'static>>
{
Box::pin(KVStore::list(&self.0, primary_namespace, secondary_namespace))
}

Expand Down
18 changes: 12 additions & 6 deletions src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2784,7 +2784,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&*self.inner,
primary_namespace,
Expand Down Expand Up @@ -3073,7 +3074,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
_page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
let keys = self
.data
.lock()
Expand Down Expand Up @@ -3192,7 +3194,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&*self.inner,
primary_namespace,
Expand Down Expand Up @@ -3400,7 +3403,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&*self.inner,
primary_namespace,
Expand Down Expand Up @@ -3516,7 +3520,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&*self.inner,
primary_namespace,
Expand Down Expand Up @@ -3662,7 +3667,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&*self.inner,
primary_namespace,
Expand Down
3 changes: 2 additions & 1 deletion src/wallet/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ mod tests {
fn list_paginated(
&self, primary_namespace: &str, secondary_namespace: &str,
page_token: Option<PageToken>,
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + Send
{
PaginatedKVStore::list_paginated(
&*self.inner,
primary_namespace,
Expand Down
6 changes: 4 additions & 2 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,8 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
+ invoice_amount_3_msat
+ determined_amount_msat
+ keysend_amount_msat)
/ 1000 - splice_out_sat;
/ 1000
- splice_out_sat;
let node_a_upper_bound_sat =
(premine_amount_sat - funding_amount_sat) + (funding_amount_sat - sum_of_all_payments_sat);
let node_a_lower_bound_sat = node_a_upper_bound_sat - onchain_fee_buffer_sat;
Expand Down Expand Up @@ -2005,7 +2006,8 @@ impl TestSyncStoreInner {
) -> lightning::io::Result<Vec<String>> {
let fs_res = KVStore::list(&self.fs_store, primary_namespace, secondary_namespace).await;
#[cfg(feature = "storage-sqlite")]
let sqlite_res = KVStore::list(&self.sqlite_store, primary_namespace, secondary_namespace).await;
let sqlite_res =
KVStore::list(&self.sqlite_store, primary_namespace, secondary_namespace).await;
let test_res =
KVStore::list(&self.test_store, primary_namespace, secondary_namespace).await;

Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3338,7 +3338,8 @@ async fn async_payment() {
.filter(|n| {
node.network_graph().node(n).map_or(false, |info| info.announcement_info.is_some())
})
.count() >= 2
.count()
>= 2
};

// Wait for everyone to see all channels and node announcements.
Expand Down