Update the coordinator to not handle a processor message multiple times

This commit is contained in:
Luke Parker
2023-09-26 23:28:05 -04:00
parent 32a9a33226
commit 2e0f8138e2
2 changed files with 20 additions and 2 deletions

View File

@@ -16,6 +16,16 @@ impl<'a, D: Db> MainDb<'a, D> {
D::key(b"coordinator_main", dst, key)
}
fn handled_message_key(id: u64) -> Vec<u8> {
Self::main_key(b"handled_message", id.to_le_bytes())
}
pub fn save_handled_message(txn: &mut D::Transaction<'_>, id: u64) {
txn.put(Self::handled_message_key(id), []);
}
pub fn handled_message<G: Get>(getter: &G, id: u64) -> bool {
getter.get(Self::handled_message_key(id)).is_some()
}
fn acive_tributaries_key() -> Vec<u8> {
Self::main_key(b"active_tributaries", [])
}