Move recognized_id from a channel to an async lambda

Fixes a race condition. Also fixes recognizing batch IDs.
This commit is contained in:
Luke Parker
2023-08-24 21:55:59 -04:00
parent ea8e26eca3
commit 32df302cc4
5 changed files with 128 additions and 110 deletions

View File

@@ -68,7 +68,7 @@ impl<'a, D: Db> MainDb<'a, D> {
) {
let key = Self::batches_in_block_key(network, block.0);
let Some(mut existing) = txn.get(&key) else {
txn.put(&key, block.0);
txn.put(&key, id);
return;
};
@@ -77,7 +77,7 @@ impl<'a, D: Db> MainDb<'a, D> {
return;
}
existing.extend(block.0);
existing.extend(id);
txn.put(&key, existing);
}