mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-20 08:05:33 +03:00
shift optimization to DataStore.get_keys_values_dict()
This commit is contained in:
parent
a5e8db7888
commit
b12ae08e3b
@ -762,6 +762,9 @@ class DataStore:
|
||||
)
|
||||
|
||||
async def get_keys_values_dict(self, tree_id: bytes32, root_hash: Optional[bytes32] = None) -> Dict[bytes, bytes]:
|
||||
if root_hash is None:
|
||||
return {}
|
||||
|
||||
pairs = await self.get_keys_values(tree_id=tree_id, root_hash=root_hash)
|
||||
return {node.key: node.value for node in pairs}
|
||||
|
||||
@ -1015,11 +1018,7 @@ class DataStore:
|
||||
) -> Optional[bytes32]:
|
||||
async with self.db_wrapper.writer():
|
||||
old_root = await self.get_tree_root(tree_id)
|
||||
root_hash = old_root.node_hash
|
||||
if old_root.node_hash is None:
|
||||
hint_keys_values = {}
|
||||
else:
|
||||
hint_keys_values = await self.get_keys_values_dict(tree_id, root_hash=root_hash)
|
||||
hint_keys_values = await self.get_keys_values_dict(tree_id, root_hash=old_root.node_hash)
|
||||
|
||||
iter_root: Optional[Root] = old_root
|
||||
for change in changelist:
|
||||
|
Loading…
Reference in New Issue
Block a user