Skip to content

Commit 055dfc9

Browse files
committed
enforce Send + Sync + 'static on generic type of the wallet manager
1 parent 032d2af commit 055dfc9

2 files changed

Lines changed: 3 additions & 15 deletions

File tree

key-wallet-manager/src/accessors.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,13 @@
33
use crate::{
44
current_timestamp, WalletCoreBalance, WalletError, WalletEvent, WalletId, WalletManager,
55
};
6-
use dashcore::prelude::CoreBlockHeight;
76
use key_wallet::wallet::managed_wallet_info::wallet_info_interface::WalletInfoInterface;
87
use key_wallet::wallet::managed_wallet_info::TransactionRecord;
98
use key_wallet::{Account, Address, Network, Utxo, Wallet};
109
use std::collections::{BTreeMap, BTreeSet};
1110
use tokio::sync::broadcast;
1211

13-
impl<T: WalletInfoInterface> WalletManager<T> {
14-
/// Return the highest last-processed height across all managed wallets.
15-
pub fn last_processed_height(&self) -> CoreBlockHeight {
16-
self.wallet_infos.values().map(|info| info.last_processed_height()).max().unwrap_or(0)
17-
}
18-
19-
/// Return the lowest durable sync checkpoint height across all managed wallets.
20-
/// This is the conservative floor used as the filter-sync resume point.
21-
pub fn synced_height(&self) -> CoreBlockHeight {
22-
self.wallet_infos.values().map(|info| info.synced_height()).min().unwrap_or(0)
23-
}
24-
12+
impl<T: WalletInfoInterface + Send + Sync + 'static> WalletManager<T> {
2513
/// Get a wallet by ID
2614
pub fn get_wallet(&self, wallet_id: &WalletId) -> Option<&Wallet> {
2715
self.wallets.get(wallet_id)

key-wallet-manager/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct CheckTransactionsResult {
8787
/// Each wallet can contain multiple accounts following BIP44 standard.
8888
/// This is the main entry point for wallet operations.
8989
#[derive(Debug)]
90-
pub struct WalletManager<T: WalletInfoInterface = ManagedWalletInfo> {
90+
pub struct WalletManager<T: WalletInfoInterface + Send + Sync + 'static = ManagedWalletInfo> {
9191
/// Network the managed wallets are used for
9292
network: Network,
9393
/// Immutable wallets indexed by wallet ID
@@ -102,7 +102,7 @@ pub struct WalletManager<T: WalletInfoInterface = ManagedWalletInfo> {
102102
event_sender: broadcast::Sender<WalletEvent>,
103103
}
104104

105-
impl<T: WalletInfoInterface> WalletManager<T> {
105+
impl<T: WalletInfoInterface + Send + Sync + 'static> WalletManager<T> {
106106
/// Create a new wallet manager
107107
pub fn new(network: Network) -> Self {
108108
Self {

0 commit comments

Comments
 (0)