diff --git a/core/Cargo.toml b/core/Cargo.toml index 63de9725..29efd741 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oracle-core" -version = "2.0.1" +version = "2.0.5" authors = [ "Robert Kornacki <11645932+robkorn@users.noreply.github.com>", "@greenhat", diff --git a/core/src/state.rs b/core/src/state.rs index e804fc58..bbcc9050 100644 --- a/core/src/state.rs +++ b/core/src/state.rs @@ -34,12 +34,10 @@ pub fn process( if let Some(local_datapoint_box_state) = live_epoch.local_datapoint_box_state { match local_datapoint_box_state { Collected { height: _ } => { - // publish datapoint after some blocks have passed after the pool box published - // to avoid some oracle box become stale on the next refresh - // (datapoint posted on the first block of the epoch go out of the epoch window too fast) - if current_height.0 - > live_epoch.latest_pool_box_height.0 + (epoch_length.0 as u32) / 2 - { + // publish datapoint in the second part of the epoch + // to avoid some oracle boxes becoming stale on next refresh + // (datapoint posted on the first block of the epoch goes out of the epoch window too fast) + if (current_height.0 - live_epoch.latest_pool_box_height.0) % epoch_length.0 as u32 > (epoch_length.0 as u32) / 2 { Some(PoolCommand::PublishSubsequentDataPoint { republish: false }) } else { None