From 3282d4a4d60e6e0466e715709ca47eeb85211859 Mon Sep 17 00:00:00 2001 From: Ivo Smits Date: Fri, 24 Feb 2023 01:21:30 +0100 Subject: [PATCH] Fixed annminer bug/feature that would prevent announcements with lower height than previous batch from being sent to handler --- packetcrypt-annmine/src/annmine.rs | 35 ++++++++++-------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/packetcrypt-annmine/src/annmine.rs b/packetcrypt-annmine/src/annmine.rs index a290287..4169390 100644 --- a/packetcrypt-annmine/src/annmine.rs +++ b/packetcrypt-annmine/src/annmine.rs @@ -345,29 +345,18 @@ fn submit_to_pool(p: &Pool, ann_struct: &AnnResult, now: u64) { Arc::clone(&pm.handlers[(ann_struct.dedup_hash as u64 % hcount) as usize]) }; let mut tip = handler.tip.lock().unwrap(); - match tip.parent_block_height.cmp(&parent_block_height) { - std::cmp::Ordering::Greater => { - debug!( - "Miner produced an old announcement, want parent_block_height {} got {}", - tip.parent_block_height, parent_block_height - ); - return; - } - std::cmp::Ordering::Less => { - // this prints for each handler - trace!( - "New block number {} -> {}", - tip.parent_block_height, - parent_block_height - ); - submit_anns( - p, - &handler, - &mut *tip, - parent_block_height, - ); - } - std::cmp::Ordering::Equal => (), + if tip.parent_block_height != parent_block_height { + trace!( + "New block number {} -> {}", + tip.parent_block_height, + parent_block_height + ); + submit_anns( + p, + &handler, + &mut *tip, + parent_block_height, + ); } tip.anns.push(ann_struct.ann.clone());