@@ -116,11 +116,13 @@ def callback(r: protocol._DecodedMsgType) -> None:
116
116
return cast (Dict [str , Any ], reply )
117
117
118
118
@alru_cache (maxsize = 1024 , cache_exceptions = False )
119
+ @service_timeout (COMPLETION_TIMEOUT )
119
120
async def get_block_header_by_hash (self , block_hash : Hash32 ) -> BlockHeader :
120
121
peer = cast (LESPeer , self .peer_pool .highest_td_peer )
121
122
return await self ._get_block_header_by_hash (peer , block_hash )
122
123
123
124
@alru_cache (maxsize = 1024 , cache_exceptions = False )
125
+ @service_timeout (COMPLETION_TIMEOUT )
124
126
async def get_block_body_by_hash (self , block_hash : Hash32 ) -> BlockBody :
125
127
peer = cast (LESPeer , self .peer_pool .highest_td_peer )
126
128
self .logger .debug ("Fetching block %s from %s" , encode_hex (block_hash ), peer )
@@ -134,6 +136,7 @@ async def get_block_body_by_hash(self, block_hash: Hash32) -> BlockBody:
134
136
# TODO add a get_receipts() method to BaseChain API, and dispatch to this, as needed
135
137
136
138
@alru_cache (maxsize = 1024 , cache_exceptions = False )
139
+ @service_timeout (COMPLETION_TIMEOUT )
137
140
async def get_receipts (self , block_hash : Hash32 ) -> List [Receipt ]:
138
141
peer = cast (LESPeer , self .peer_pool .highest_td_peer )
139
142
self .logger .debug ("Fetching %s receipts from %s" , encode_hex (block_hash ), peer )
@@ -148,6 +151,7 @@ async def get_receipts(self, block_hash: Hash32) -> List[Receipt]:
148
151
# request accounts and code (and storage?)
149
152
150
153
@alru_cache (maxsize = 1024 , cache_exceptions = False )
154
+ @service_timeout (COMPLETION_TIMEOUT )
151
155
async def get_account (self , block_hash : Hash32 , address : Address ) -> Account :
152
156
return await self ._retry_on_bad_response (
153
157
partial (self ._get_account_from_peer , block_hash , address )
0 commit comments