We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c5d1f8 commit bd1f2a8Copy full SHA for bd1f2a8
mithril-network/mithril-aggregator/src/fake_data.rs
@@ -1,12 +1,18 @@
1
#![allow(dead_code)]
2
3
+use std::time::{SystemTime, UNIX_EPOCH};
4
+
5
use crate::entities;
6
7
/// Fake Beacon
8
pub fn beacon() -> entities::Beacon {
9
let network = "testnet".to_string();
- let epoch = 196;
- let block = 3443000;
10
+ let seconds_since_unix_epoch = SystemTime::now()
11
+ .duration_since(UNIX_EPOCH)
12
+ .unwrap()
13
+ .as_secs();
14
+ let epoch = seconds_since_unix_epoch / 86400_u64; // 1 epoch every day
15
+ let block = 100 * (seconds_since_unix_epoch / (5 * 100)) as u64; // 1 block every 5s and 1 snapshot every 100 blocks
16
entities::Beacon::new(network, epoch, block)
17
}
18
0 commit comments