Make soak tests work again now that we subscribe by genesis hash (#399)

* Make soak tests work again with genesis hash subscribing

* cargo fmt

* derive hex from hash

* actually compile code

* fmt

Co-authored-by: David Palm <dvdplm@gmail.com>
This commit is contained in:
James Wilson
2021-09-10 11:28:34 +01:00
committed by GitHub
parent 3ea2f88b19
commit 0b0cec0512
2 changed files with 21 additions and 21 deletions
+7 -14
View File
@@ -8,22 +8,14 @@ use tokio::time::{self, MissedTickBehavior};
/// This emits fake but realistic looking telemetry messages.
/// Can be connected to a telemetry server to emit realistic messages.
pub struct FakeTelemetry {
block_time: Duration,
node_name: String,
chain: String,
message_id: usize,
pub block_time: Duration,
pub node_name: String,
pub chain: String,
pub genesis_hash: BlockHash,
pub message_id: usize,
}
impl FakeTelemetry {
pub fn new(block_time: Duration, node_name: String, chain: String, message_id: usize) -> Self {
Self {
block_time,
node_name,
chain,
message_id,
}
}
/// Begin emitting messages from this node, calling the provided callback each
/// time a new message is emitted.
// Unused assignments allowed because macro seems to mess with knowledge of what's
@@ -38,6 +30,7 @@ impl FakeTelemetry {
let id = self.message_id;
let name = self.node_name;
let chain = self.chain;
let genesis_hash = self.genesis_hash;
let block_time = self.block_time;
// Our "state". These numbers can be hashed to give a block hash,
@@ -62,7 +55,7 @@ impl FakeTelemetry {
"authority":true,
"chain":chain,
"config":"",
"genesis_hash":block_hash(best_block_n),
"genesis_hash":genesis_hash,
"implementation":"Substrate Node",
"msg":"system.connected",
"name":name,