Send a heartbeat message when a Tributary falls behind

This commit is contained in:
Luke Parker
2023-04-23 18:55:43 -04:00
parent 72633d6421
commit 05b1fc5f05
5 changed files with 53 additions and 3 deletions

View File

@@ -143,6 +143,9 @@ impl<D: Db, T: Transaction, P: P2p> Tributary<D, T, P> {
pub fn block(&self, hash: &[u8; 32]) -> Option<Block<T>> {
self.network.blockchain.read().unwrap().block(hash)
}
pub fn time_of_block(&self, hash: &[u8; 32]) -> Option<u64> {
self.network.blockchain.read().unwrap().commit(hash).map(|commit| Commit::<Validators>::decode(&mut commit.as_ref()).unwrap().end_time)
}
pub fn commit(&self, hash: &[u8; 32]) -> Option<Vec<u8>> {
self.network.blockchain.read().unwrap().commit(hash)
}