full_node: Avoid some list copying in FullNode.update_wallets (#14827)

* full_node: Just add `new_states` since the entries can't be `None`

* Drop list creation, `lookup_coin_ids` is already a list
This commit is contained in:
dustinface 2023-03-21 01:17:37 +07:00 committed by GitHub
parent 39d5283f1a
commit 6b39c133c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1171,7 +1171,7 @@ class FullNode:
lookup_coin_ids: List[bytes32],
) -> None:
# Looks up coin records in DB for the coins that wallets are interested in
new_states: List[CoinRecord] = await self.coin_store.get_coin_records(list(lookup_coin_ids))
new_states: List[CoinRecord] = await self.coin_store.get_coin_records(lookup_coin_ids)
# Re-arrange to a map, and filter out any non-ph sized hint
coin_id_to_ph_hint: Dict[bytes32, bytes32] = {
@ -1179,7 +1179,7 @@ class FullNode:
}
changes_for_peer: Dict[bytes32, Set[CoinState]] = {}
for coin_record in state_change_summary.rolled_back_records + [s for s in new_states if s is not None]:
for coin_record in state_change_summary.rolled_back_records + new_states:
cr_name: bytes32 = coin_record.name
for peer in self.subscriptions.peers_for_coin_id(cr_name):