From 30611d0a68a2fe4bb7a5fc2bf1c2dff90c93c3c9 Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Mon, 2 Mar 2020 15:43:52 +0000 Subject: [PATCH] Reversed Client ledger mapping --- .../src/provider/client_handling/ledger.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sfw-provider/src/provider/client_handling/ledger.rs b/sfw-provider/src/provider/client_handling/ledger.rs index cb615d240f..b8deea12d0 100644 --- a/sfw-provider/src/provider/client_handling/ledger.rs +++ b/sfw-provider/src/provider/client_handling/ledger.rs @@ -21,16 +21,16 @@ impl ClientLedger { } } - pub(crate) async fn has_token(&self, auth_token: &AuthToken) -> bool { - self.inner.lock().await.0.contains_key(auth_token) + pub(crate) async fn has_client(&self, client_address: &DestinationAddressBytes) -> bool { + self.inner.lock().await.0.contains_key(client_address) } pub(crate) async fn insert_token( &mut self, auth_token: AuthToken, client_address: DestinationAddressBytes, - ) -> Option { - self.inner.lock().await.0.insert(auth_token, client_address) + ) -> Option { + self.inner.lock().await.0.insert(client_address, auth_token) } pub(crate) async fn current_clients(&self) -> Vec { @@ -38,8 +38,8 @@ impl ClientLedger { .lock() .await .0 - .iter() - .map(|(_, v)| v.to_base58_string()) + .keys() + .map(|client_address| client_address.to_base58_string()) .map(|pub_key| MixProviderClient { pub_key }) .collect() } @@ -57,4 +57,4 @@ impl ClientLedger { } } -struct ClientLedgerInner(HashMap); +struct ClientLedgerInner(HashMap);