Skip to content

Commit

Permalink
as conn
Browse files Browse the repository at this point in the history
  • Loading branch information
wjblanke committed Jan 11, 2025
1 parent 36128e3 commit 596629c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ async def short_sync_batch(self, peer: WSChiaConnection, start_height: uint32, t
vs = ValidationState(ssi, diff, None)

# Wrap add_block_batch with writer to ensure all writes and reads are on same connection.
async with self.block_store.db_wrapper.writer():
async with self.block_store.db_wrapper.writer() as conn:
success, state_change_summary = await self.add_block_batch(
response.blocks, peer_info, fork_info, vs
)
Expand Down Expand Up @@ -1357,7 +1357,7 @@ async def ingest_blocks(
pre_validation_results = list(await asyncio.gather(*futures))

# Wrap add_prevalidated_blocks with writer to ensure all writes and reads are on same connection.
async with self.block_store.db_wrapper.writer():
async with self.block_store.db_wrapper.writer() as conn:
# The ValidationState object (vs) is an in-out parameter. the add_block_batch()
# call will update it
state_change_summary, err = await self.add_prevalidated_blocks(
Expand Down Expand Up @@ -2097,7 +2097,7 @@ async def add_block(
async with (
self.blockchain.priority_mutex.acquire(priority=BlockchainMutexPriority.high),
# Wrap with writer to ensure all writes and reads are on same connection.
self.block_store.db_wrapper.writer(),
self.block_store.db_wrapper.writer() as conn,
enable_profiler(self.profile_block_validation) as pr,
):
# After acquiring the lock, check again, because another asyncio thread might have added it
Expand Down

0 comments on commit 596629c

Please sign in to comment.