wallet: Drop async for can_use_peer_request_cache (#14472)

Make `can_use_peer_request_cache` a sync method
This commit is contained in:
dustinface 2023-02-09 10:27:10 +07:00 committed by GitHub
parent 28b4dfd756
commit f62f243e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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()):

View File

@ -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)