Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed duplication of FIRE BLOCK just to silence the payload #116

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions src/polling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
forever,
latest: 0,
ptr: 0,
quiet: quiet,

Check failure on line 62 in src/polling.rs

View workflow job for this annotation

GitHub Actions / Clippy

redundant field names in struct initialization
};

poller.initialize_start_ptr(ptr).await?;
Expand Down Expand Up @@ -113,7 +113,7 @@
async fn start_ptr_from_last_irreversible(&self) -> Result<u64> {
log::info!("user requested 'live' block, retrieving it from endpoint");

self.latest_irreversible_block_num()

Check failure on line 116 in src/polling.rs

View workflow job for this annotation

GitHub Actions / Clippy

using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
.await
.and_then(|live_block| {
log::info!(
Expand All @@ -126,7 +126,7 @@
}

async fn start_ptr_from_flag_value(&self, value: &String) -> Result<u64> {
value

Check failure on line 129 in src/polling.rs

View workflow job for this annotation

GitHub Actions / Clippy

using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
.parse::<u64>()
.and_then(|value| {
log::info!(
Expand Down Expand Up @@ -171,29 +171,22 @@
};

let encoded: Block = b.try_into()?;

if self.quiet {
println!(
"FIRE BLOCK {} {} {} {} {} {}",
block_num,
hex::encode(block_hash),
parent_num,
hex::encode(parent_hash),
lib,
timestamp
);
let block_payload = if self.quiet {
"<trimmed>".to_string()
} else {
println!(
"FIRE BLOCK {} {} {} {} {} {} {}",
block_num,
hex::encode(block_hash),
parent_num,
hex::encode(parent_hash),
lib,
timestamp,
general_purpose::STANDARD.encode(encoded.encode_to_vec())
);
}
general_purpose::STANDARD.encode(encoded.encode_to_vec())
};

println!(
"FIRE BLOCK {} {} {} {} {} {} {}",
block_num,
hex::encode(block_hash),
parent_num,
hex::encode(parent_hash),
lib,
timestamp,
block_payload
);

Ok(())
}
Expand Down
Loading