[ouroboros] organize order of background execution

This commit is contained in:
mohab metwally
2022-10-21 19:25:48 +02:00
parent d92ed5f2b8
commit 852c89d917
2 changed files with 10 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ async fn main() {
block_on(Stakeholder::new(epoch_consensus, settings, &path, id, Some(k))).unwrap();
let handle = thread::spawn(move || {
block_on(stakeholder.background(Some(9)));
block_on(stakeholder.background(Some(100)));
});
handle.join().unwrap();
}

View File

@@ -252,6 +252,7 @@ impl Stakeholder {
let _ = self.clock.sync().await;
let mut c: u8 = 0;
let lim: u8 = hardlimit.unwrap_or(0);
let mut epoch_not_started = true;
while self.playing {
if c > lim && lim > 0 {
break
@@ -263,12 +264,18 @@ impl Stakeholder {
Ticks::GENESIS { e, sl } => {
self.new_epoch(e, sl);
self.new_slot(e, sl);
epoch_not_started = false;
}
Ticks::NEWEPOCH { e, sl } => {
self.new_epoch(e, sl);
self.new_slot(e, sl);
//self.new_slot(e, sl);
epoch_not_started = false;
}
Ticks::NEWSLOT { e, sl } => {
if !epoch_not_started {
self.new_slot(e, sl);
}
}
Ticks::NEWSLOT { e, sl } => self.new_slot(e, sl),
Ticks::TOCKS => {
info!(target: LOG_T, "tocks");
// slot is about to end.