11from __future__ import annotations
22
3+ from contextlib import AbstractAsyncContextManager
34from typing import Optional , Protocol
45
56from chia_rs import BlockRecord , FullBlock , SubEpochChallengeSegment
1112
1213class BlockStoreProtocol (Protocol ):
1314 async def add_full_block (self , header_hash : bytes32 , block : FullBlock , block_record : BlockRecord ) -> None : ...
14-
15+ def get_block_from_cache ( self , header_hash : bytes32 ) -> Optional [ FullBlock ]: ...
1516 async def get_full_block (self , header_hash : bytes32 ) -> Optional [FullBlock ]: ...
16-
1717 async def get_full_block_bytes (self , header_hash : bytes32 ) -> Optional [bytes ]: ...
18-
1918 async def get_full_blocks_at (self , heights : list [uint32 ]) -> list [FullBlock ]: ...
20-
2119 async def get_block_info (self , header_hash : bytes32 ) -> Optional [GeneratorBlockInfo ]: ...
22-
2320 async def get_generator (self , header_hash : bytes32 ) -> Optional [bytes ]: ...
24-
2521 async def get_generators_at (self , heights : set [uint32 ]) -> dict [uint32 , bytes ]: ...
26-
2722 async def get_block_record (self , header_hash : bytes32 ) -> Optional [BlockRecord ]: ...
28-
29- async def get_block_records_in_range (
30- self ,
31- start : int ,
32- stop : int ,
33- ) -> dict [bytes32 , BlockRecord ]: ...
34-
23+ async def get_block_records_in_range (self , start : int , stop : int ) -> dict [bytes32 , BlockRecord ]: ...
3524 async def get_block_records_by_hash (self , header_hashes : list [bytes32 ]) -> list [BlockRecord ]: ...
36-
3725 async def get_block_bytes_by_hash (self , header_hashes : list [bytes32 ]) -> list [bytes ]: ...
38-
3926 async def get_blocks_by_hash (self , header_hashes : list [bytes32 ]) -> list [FullBlock ]: ...
40-
4127 async def get_peak (self ) -> Optional [tuple [bytes32 , uint32 ]]: ...
42-
43- async def get_block_bytes_in_range (
44- self ,
45- start : int ,
46- stop : int ,
47- ) -> list [bytes ]: ...
48-
28+ async def get_block_bytes_in_range (self , start : int , stop : int ) -> list [bytes ]: ...
4929 async def get_random_not_compactified (self , number : int ) -> list [int ]: ...
50-
5130 async def persist_sub_epoch_challenge_segments (
5231 self , ses_block_hash : bytes32 , segments : list [SubEpochChallengeSegment ]
5332 ) -> None : ...
54-
5533 async def get_sub_epoch_challenge_segments (
5634 self ,
5735 ses_block_hash : bytes32 ,
5836 ) -> Optional [list [SubEpochChallengeSegment ]]: ...
59-
6037 async def rollback (self , height : int ) -> None : ...
61-
38+ def rollback_cache_block ( self , header_hash : bytes32 ) -> None : ...
6239 async def set_in_chain (self , header_hashes : list [tuple [bytes32 ]]) -> None : ...
63-
6440 async def set_peak (self , header_hash : bytes32 ) -> None : ...
65-
6641 async def is_fully_compactified (self , header_hash : bytes32 ) -> Optional [bool ]: ...
67-
6842 async def replace_proof (self , header_hash : bytes32 , block : FullBlock ) -> None : ...
69-
7043 async def count_compactified_blocks (self ) -> int : ...
71-
7244 async def count_uncompactified_blocks (self ) -> int : ...
45+ async def get_block_records_close_to_peak (self , blocks_n : int ) -> tuple [dict [bytes32 , BlockRecord ], Optional [bytes32 ]]: ...
46+ def get_host_parameter_limit (self ) -> int : ...
47+ async def get_prev_hash (self , header_hash : bytes32 ) -> bytes32 : ...
48+ def transaction (self ) -> AbstractAsyncContextManager [None ]: ...
0 commit comments