Skip to content

Commit 3923c13

Browse files
committed
dataclass
1 parent ec71171 commit 3923c13

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

chia/full_node/consensus_store_sqlite3.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

3-
import dataclasses
43
from collections.abc import AsyncIterator, Collection
54
from contextlib import AbstractAsyncContextManager
5+
from dataclasses import dataclass
66
from pathlib import Path
77
from types import TracebackType
88
from typing import TYPE_CHECKING, Any, Optional
@@ -19,30 +19,30 @@
1919
from chia.util.db_wrapper import DBWrapper2
2020

2121

22+
@dataclass
2223
class ConsensusStoreSQLite3Writer:
23-
def __init__(self, block_store: BlockStore, coin_store: CoinStore):
24-
self._block_store = block_store
25-
self._coin_store = coin_store
24+
block_store: BlockStore
25+
coin_store: CoinStore
2626

2727
async def add_full_block(self, header_hash: bytes32, block: FullBlock, block_record: BlockRecord) -> None:
28-
await self._block_store.add_full_block(header_hash, block, block_record)
28+
await self.block_store.add_full_block(header_hash, block, block_record)
2929

3030
async def rollback(self, height: int) -> None:
31-
await self._block_store.rollback(height)
31+
await self.block_store.rollback(height)
3232

3333
async def set_in_chain(self, header_hashes: list[tuple[bytes32]]) -> None:
34-
await self._block_store.set_in_chain(header_hashes)
34+
await self.block_store.set_in_chain(header_hashes)
3535

3636
async def set_peak(self, header_hash: bytes32) -> None:
37-
await self._block_store.set_peak(header_hash)
37+
await self.block_store.set_peak(header_hash)
3838

3939
async def persist_sub_epoch_challenge_segments(
4040
self, ses_block_hash: bytes32, segments: list[SubEpochChallengeSegment]
4141
) -> None:
42-
await self._block_store.persist_sub_epoch_challenge_segments(ses_block_hash, segments)
42+
await self.block_store.persist_sub_epoch_challenge_segments(ses_block_hash, segments)
4343

4444
async def rollback_to_block(self, block_index: int) -> dict[bytes32, CoinRecord]:
45-
return await self._coin_store.rollback_to_block(block_index)
45+
return await self.coin_store.rollback_to_block(block_index)
4646

4747
async def new_block(
4848
self,
@@ -52,7 +52,7 @@ async def new_block(
5252
tx_additions: Collection[tuple[bytes32, Coin, bool]],
5353
tx_removals: list[bytes32],
5454
) -> None:
55-
await self._coin_store.new_block(height, timestamp, included_reward_coins, tx_additions, tx_removals)
55+
await self.coin_store.new_block(height, timestamp, included_reward_coins, tx_additions, tx_removals)
5656

5757

5858
@dataclasses.dataclass

0 commit comments

Comments
 (0)