mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-27 18:39:32 +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")]
|
#[method(name = "sendTransaction")]
|
||||||
async fn send_transaction(&self, tx: NSSATransaction) -> Result<HashType, ErrorObjectOwned>;
|
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")]
|
#[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
|
// TODO: These functions should be removed after wallet starts using indexer
|
||||||
// for this type of queries.
|
// for this type of queries.
|
||||||
|
|||||||
@ -82,8 +82,9 @@ impl<BC: BlockSettlementClientTrait + Send + 'static, IC: IndexerClientTrait + S
|
|||||||
Ok(tx_hash)
|
Ok(tx_hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn check_health(&self) -> Result<(), ErrorObjectOwned> {
|
async fn check_health(&self) -> Result<BlockId, ErrorObjectOwned> {
|
||||||
Ok(())
|
let sequencer = self.sequencer.lock().await;
|
||||||
|
Ok(sequencer.chain_height())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_block(&self, block_id: BlockId) -> Result<Option<Block>, ErrorObjectOwned> {
|
async fn get_block(&self, block_id: BlockId) -> Result<Option<Block>, ErrorObjectOwned> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user