mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-03-18 18:03:07 +00:00
feat: event system and state extension
This commit is contained in:
parent
b143beef37
commit
93bc4d51c3
@ -1,4 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use anyhow::Result;
|
||||
use bedrock_client::{BasicAuthCredentials, BedrockClient};
|
||||
@ -45,6 +45,7 @@ impl IndexerCore {
|
||||
// No state setup for now, future task.
|
||||
state: IndexerState {
|
||||
latest_seen_block: Arc::new(RwLock::new(0)),
|
||||
finality_map: Arc::new(RwLock::new(HashMap::new())),
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -93,7 +94,7 @@ impl IndexerCore {
|
||||
}
|
||||
|
||||
// Sending data into sequencer, may need to be expanded.
|
||||
let message = IndexerToSequencerMessage::BlockObserved {
|
||||
let message = IndexerToSequencerMessage::FinalizedBlockObserved {
|
||||
l1_block_id: block_info.height,
|
||||
l2_block_height: l2_block.block_id,
|
||||
};
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum IndexerToSequencerMessage {
|
||||
BlockObserved {
|
||||
FinalizedBlockObserved {
|
||||
l1_block_id: u64,
|
||||
l2_block_height: u64,
|
||||
},
|
||||
BlockEnteredChain {
|
||||
l2_block_height: u64,
|
||||
},
|
||||
ChainRestructurization {
|
||||
new_l1_last_block_height: u64,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct IndexerState {
|
||||
// Only one field for now, for testing.
|
||||
pub latest_seen_block: Arc<RwLock<u64>>,
|
||||
pub finality_map: Arc<RwLock<HashMap<u64, u64>>>,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user