aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/main.rs
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-04-24 01:44:47 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-04-24 01:44:47 +0100
commit9ebbb9ee741c1d78a52789a646af83bce21e5a78 (patch)
tree20e122861f2abe3177f56feb87092a3e30c7eff8 /src/main.rs
parent33fca2084e3d6d7f28be7f453c5f23977e805171 (diff)
downloadsentrum-9ebbb9ee741c1d78a52789a646af83bce21e5a78.tar.gz
sentrum-9ebbb9ee741c1d78a52789a646af83bce21e5a78.tar.bz2
sentrum-9ebbb9ee741c1d78a52789a646af83bce21e5a78.zip
Simplify function return type
It does not need to return a Result.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index 902b26f..436bbdd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -65,10 +65,10 @@ fn set_signal_handlers() -> Result<()> {
Ok(())
}
-fn get_and_handle_new_txs(
+async fn get_and_handle_new_txs(
wallet_info: &SafeWalletInfo,
actions: &[&(dyn Action<'_> + Sync)],
-) -> Result<()> {
+) {
let mut locked_wallet_info = wallet_info.lock().unwrap();
let txs = locked_wallet_info.get_new_txs();
TokioScope::scope_and_block(|s| {
@@ -78,7 +78,6 @@ fn get_and_handle_new_txs(
s.spawn(run_actions(actions, Some(params)));
}
});
- Ok(())
}
async fn update_blockchain_thread(blockchain_state: &mut BlockchainState) {
@@ -90,9 +89,7 @@ async fn update_blockchain_thread(blockchain_state: &mut BlockchainState) {
async fn watch_wallet_thread(wallet_info: &SafeWalletInfo, actions: &[&(dyn Action<'_> + Sync)]) {
loop {
- if let Err(e) = get_and_handle_new_txs(wallet_info, actions) {
- warn!("{:?}", e);
- }
+ get_and_handle_new_txs(wallet_info, actions).await;
}
}
@@ -100,11 +97,7 @@ async fn initial_wallet_sync(blockchain_state: &mut BlockchainState, wallets: &[
TokioScope::scope_and_block(|s| {
s.spawn(async { blockchain_state.update_height() });
for wallet_info in wallets {
- s.spawn(async {
- if let Err(e) = get_and_handle_new_txs(wallet_info, &[]) {
- warn!("{:?}", e);
- }
- });
+ s.spawn(get_and_handle_new_txs(wallet_info, &[]));
}
});
}