From f62f243e69cd610dbfae8f69a4ee4f1efa6d210f Mon Sep 17 00:00:00 2001 From: dustinface <35775977+xdustinface@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:27:10 +0700 Subject: [PATCH] wallet: Drop `async` for `can_use_peer_request_cache` (#14472) Make `can_use_peer_request_cache` a sync method --- chia/wallet/util/peer_request_cache.py | 2 +- chia/wallet/wallet_node.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chia/wallet/util/peer_request_cache.py b/chia/wallet/util/peer_request_cache.py index 6440766f69af..c99847d19a7d 100644 --- a/chia/wallet/util/peer_request_cache.py +++ b/chia/wallet/util/peer_request_cache.py @@ -132,7 +132,7 @@ class PeerRequestCache: self._additions_in_block = new_additions_in_block -async def can_use_peer_request_cache( +def can_use_peer_request_cache( coin_state: CoinState, peer_request_cache: PeerRequestCache, fork_height: Optional[uint32] ) -> bool: if not peer_request_cache.in_states_validated(coin_state.get_hash()): diff --git a/chia/wallet/wallet_node.py b/chia/wallet/wallet_node.py index b689d0390077..b5995888d643 100644 --- a/chia/wallet/wallet_node.py +++ b/chia/wallet/wallet_node.py @@ -1362,7 +1362,7 @@ class WalletNode: """ # Only use the cache if we are talking about states before the fork point. If we are evaluating something # in a reorg, we cannot use the cache, since we don't know if it's actually in the new chain after the reorg. - if await can_use_peer_request_cache(coin_state, peer_request_cache, fork_height): + if can_use_peer_request_cache(coin_state, peer_request_cache, fork_height): return True spent_height: Optional[uint32] = None if coin_state.spent_height is None else uint32(coin_state.spent_height)