Skip to content

Commit 36d8e2f

Browse files
authored
properly seed intra-sync persistent delta reader cache on new sync (#19702)
1 parent 53b2f90 commit 36d8e2f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

chia/data_layer/data_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ async def insert_into_data_store_from_file(
200200
root_hash: Optional[bytes32],
201201
filename: Path,
202202
delta_reader: Optional[DeltaReader] = None,
203-
) -> None:
203+
) -> Optional[DeltaReader]:
204204
if root_hash is None:
205205
merkle_blob = MerkleBlob(b"")
206206
else:
@@ -233,6 +233,7 @@ async def insert_into_data_store_from_file(
233233

234234
# Don't store these blob objects into cache, since their data structures are not calculated yet.
235235
await self.insert_root_from_merkle_blob(merkle_blob, store_id, Status.COMMITTED, update_cache=False)
236+
return delta_reader
236237

237238
async def build_merkle_blob_queries_for_missing_hashes(
238239
self,

chia/data_layer/download_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ async def insert_from_delta_file(
177177
if group_files_by_store:
178178
client_foldername.joinpath(f"{store_id}").mkdir(parents=True, exist_ok=True)
179179

180-
delta_reader = DeltaReader(internal_nodes={}, leaf_nodes={})
180+
delta_reader: Optional[DeltaReader] = None
181181

182182
for root_hash in root_hashes:
183183
timestamp = int(time.time())
@@ -218,7 +218,7 @@ async def insert_from_delta_file(
218218
existing_generation,
219219
group_files_by_store,
220220
)
221-
await data_store.insert_into_data_store_from_file(
221+
delta_reader = await data_store.insert_into_data_store_from_file(
222222
store_id,
223223
None if root_hash == bytes32.zeros else root_hash,
224224
target_filename_path,

0 commit comments

Comments
 (0)