Skip to content

Commit

Permalink
Merge pull request #59 from pkt-world/fix-top-height
Browse files Browse the repository at this point in the history
Fixed work tip height detection
  • Loading branch information
cjdelisle authored Feb 8, 2023
2 parents 866ffc1 + ecea75e commit cb0a674
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packetcrypt-annmine/src/annmine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,23 @@ fn update_work_cycle(am: &AnnMine, p: &Arc<Pool>, update: PoolUpdate) -> Vec<Arc
pm.handlers = new_handlers;
}

let mut top = 0;
for bi in update.update_blocks {
if let Some(rw) = pm.recent_work[(bi.header.height as usize) % RECENT_WORK_BUF].as_ref() {
if rw.header.height > bi.header.height {
// Old
continue;
}
}
top = max(bi.header.height, top);
pm.recent_work[(bi.header.height as usize) % RECENT_WORK_BUF] = Some(bi);
}

let mut top = 0;
for opt in pm.recent_work {
if let Some(rw) = opt {
top = max(rw.header.height, top);
}
}

let mine_old = if am.cfg.mine_old_anns > -1 {
am.cfg.mine_old_anns
} else {
Expand Down

0 comments on commit cb0a674

Please sign in to comment.