mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-04-12 14:13:07 +00:00
feat: improve sequencer healthcheck to return chain height
Previously check_health() always returned Ok(()) without checking anything meaningful. A sequencer could be stuck and still pass. Now check_health() returns the current chain height (BlockId). Clients can call this twice with a delay to verify the chain is progressing. Refs #244
This commit is contained in:
parent
fb083ce91e
commit
c1924e1ccc
@ -39,9 +39,10 @@ pub trait Rpc {
|
||||
#[method(name = "sendTransaction")]
|
||||
async fn send_transaction(&self, tx: NSSATransaction) -> Result<HashType, ErrorObjectOwned>;
|
||||
|
||||
// TODO: expand healthcheck response into some kind of report
|
||||
/// Returns the current chain height (block count).
|
||||
/// A sequencer is healthy if this value increases over time.
|
||||
#[method(name = "checkHealth")]
|
||||
async fn check_health(&self) -> Result<(), ErrorObjectOwned>;
|
||||
async fn check_health(&self) -> Result<BlockId, ErrorObjectOwned>;
|
||||
|
||||
// TODO: These functions should be removed after wallet starts using indexer
|
||||
// for this type of queries.
|
||||
|
||||
@ -82,8 +82,9 @@ impl<BC: BlockSettlementClientTrait + Send + 'static, IC: IndexerClientTrait + S
|
||||
Ok(tx_hash)
|
||||
}
|
||||
|
||||
async fn check_health(&self) -> Result<(), ErrorObjectOwned> {
|
||||
Ok(())
|
||||
async fn check_health(&self) -> Result<BlockId, ErrorObjectOwned> {
|
||||
let sequencer = self.sequencer.lock().await;
|
||||
Ok(sequencer.chain_height())
|
||||
}
|
||||
|
||||
async fn get_block(&self, block_id: BlockId) -> Result<Option<Block>, ErrorObjectOwned> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user