4
4
use acropolis_common:: {
5
5
messages:: { CardanoMessage , Message , StateQuery , StateQueryResponse } ,
6
6
queries:: epochs:: {
7
- BlockHashesByPool , BlocksMintedByPools , BlocksMintedInfoByPool , EpochInfo ,
8
- EpochsStateQuery , EpochsStateQueryResponse , LatestEpoch , TotalBlocksMintedByPools ,
7
+ EpochInfo , EpochsStateQuery , EpochsStateQueryResponse , LatestEpoch ,
9
8
DEFAULT_EPOCHS_QUERY_TOPIC ,
10
9
} ,
11
10
state_history:: { StateHistory , StateHistoryStore } ,
@@ -50,14 +49,13 @@ impl EpochsState {
50
49
async fn run (
51
50
history : Arc < Mutex < StateHistory < State > > > ,
52
51
epochs_history : EpochsHistoryState ,
53
- store_config : & StoreConfig ,
54
52
mut headers_subscription : Box < dyn Subscription < Message > > ,
55
53
mut fees_subscription : Box < dyn Subscription < Message > > ,
56
54
mut epoch_activity_publisher : EpochActivityPublisher ,
57
55
) -> Result < ( ) > {
58
56
loop {
59
57
// Get a mutable state
60
- let mut state = history. lock ( ) . await . get_or_init_with ( || State :: new ( store_config ) ) ;
58
+ let mut state = history. lock ( ) . await . get_or_init_with ( || State :: new ( ) ) ;
61
59
let mut current_block: Option < BlockInfo > = None ;
62
60
63
61
// Read both topics in parallel
@@ -113,9 +111,7 @@ impl EpochsState {
113
111
// are suppressed upstream
114
112
match MultiEraHeader :: decode ( variant, None , & header_msg. raw ) {
115
113
Ok ( header) => {
116
- if let Some ( vrf_vkey) = header. vrf_vkey ( ) {
117
- state. handle_mint ( & block_info, Some ( vrf_vkey) ) ;
118
- }
114
+ state. handle_mint ( & block_info, header. vrf_vkey ( ) ) ;
119
115
}
120
116
121
117
Err ( e) => error ! ( "Can't decode header {}: {e}" , block_info. slot) ,
@@ -231,43 +227,12 @@ impl EpochsState {
231
227
}
232
228
}
233
229
234
- EpochsStateQuery :: GetBlocksMintedByPools { vrf_key_hashes } => {
235
- EpochsStateQueryResponse :: BlocksMintedByPools ( BlocksMintedByPools {
236
- blocks_minted : state. get_blocks_minted_by_pools ( vrf_key_hashes) ,
237
- } )
238
- }
239
-
240
- EpochsStateQuery :: GetTotalBlocksMintedByPools { vrf_key_hashes } => {
241
- EpochsStateQueryResponse :: TotalBlocksMintedByPools (
242
- TotalBlocksMintedByPools {
243
- total_blocks_minted : state
244
- . get_total_blocks_minted_by_pools ( vrf_key_hashes) ,
245
- } ,
230
+ EpochsStateQuery :: GetLatestEpochBlocksMintedByPool { vrf_key_hash } => {
231
+ EpochsStateQueryResponse :: LatestEpochBlocksMintedByPool (
232
+ state. get_latest_epoch_blocks_minted_by_pool ( vrf_key_hash) ,
246
233
)
247
234
}
248
235
249
- EpochsStateQuery :: GetBlocksMintedInfoByPool { vrf_key_hash } => {
250
- let ( total_blocks_minted, epoch_blocks_minted) =
251
- state. get_blocks_minted_data_by_pool ( vrf_key_hash) ;
252
- EpochsStateQueryResponse :: BlocksMintedInfoByPool ( BlocksMintedInfoByPool {
253
- total_blocks_minted,
254
- epoch_blocks_minted,
255
- } )
256
- }
257
-
258
- EpochsStateQuery :: GetBlockHashesByPool { vrf_key_hash } => {
259
- if state. is_block_hashes_enabled ( ) {
260
- let hashes = state. get_block_hashes ( vrf_key_hash) ;
261
- EpochsStateQueryResponse :: BlockHashesByPool ( BlockHashesByPool {
262
- hashes,
263
- } )
264
- } else {
265
- EpochsStateQueryResponse :: Error (
266
- "Block hashes are not enabled" . to_string ( ) ,
267
- )
268
- }
269
- }
270
-
271
236
_ => EpochsStateQueryResponse :: Error ( format ! (
272
237
"Unimplemented query variant: {:?}" ,
273
238
query
@@ -284,7 +249,6 @@ impl EpochsState {
284
249
Self :: run (
285
250
history,
286
251
epochs_history,
287
- & store_config,
288
252
headers_subscription,
289
253
fees_subscription,
290
254
epoch_activity_publisher,
0 commit comments