fix all clippy

This commit is contained in:
GroovieGermanikus 2023-12-15 10:28:25 +01:00
parent 7c1319377d
commit 0e4b5bf1ea
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
4 changed files with 30 additions and 17 deletions

11
Cargo.lock generated
View File

@ -1249,6 +1249,7 @@ dependencies = [
"futures",
"itertools",
"log",
"merge-streams",
"prometheus",
"solana-sdk",
"tokio",
@ -1717,6 +1718,16 @@ dependencies = [
"autocfg",
]
[[package]]
name = "merge-streams"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f84f6452969abd246e7ac1fe4fe75906c76e8ec88d898df9aef37e0f3b6a7c2"
dependencies = [
"futures-core",
"pin-project",
]
[[package]]
name = "merlin"
version = "3.0.0"

View File

@ -97,23 +97,25 @@ pub async fn main() {
match msg_or_timeout {
Ok(Some(offer_block_msg)) => {
// collect the offered slots from the channels
if let OfferBlockMsg::NextSlot(label, block_offered) = offer_block_msg {
info!("<< offered slot from {}: {:?}", label, block_offered);
match offer_block_msg {
OfferBlockMsg::NextSlot(label, block_offered) => {
info!("<< offered slot from {}: {:?}", label, block_offered);
// TOOD use .parent instead
if block_offered.parent_slot == current_tip {
current_tip = block_offered.slot;
info!("<< take block from {} as new tip {}", label, current_tip);
assert_ne!(current_tip, 0, "must not see uninitialized tip");
// TOOD use .parent instead
if block_offered.parent_slot == current_tip {
current_tip = block_offered.slot;
info!("<< take block from {} as new tip {}", label, current_tip);
assert_ne!(current_tip, 0, "must not see uninitialized tip");
emit_block_on_multiplex_output_channel(&sx_multi, current_tip);
tx_tip.send(current_tip).unwrap();
blocks_offered.clear();
continue 'main_loop;
} else {
// keep the block for later
blocks_offered.push(block_offered);
continue 'main_loop;
emit_block_on_multiplex_output_channel(&sx_multi, current_tip);
tx_tip.send(current_tip).unwrap();
blocks_offered.clear();
continue 'main_loop;
} else {
// keep the block for later
blocks_offered.push(block_offered);
continue 'main_loop;
}
}
}
// TODO handle else

View File

@ -69,7 +69,7 @@ pub async fn create_multiplex(
let mut current_slot: Slot = 0;
'main_loop: loop {
loop {
let block_cmd = select! {
message = &mut merged_futures => {
match message {

View File

@ -1,6 +1,6 @@
use crate::grpc_subscription_autoreconnect::{create_geyser_reconnecting_stream, GrpcSourceConfig};
use async_stream::stream;
use futures::{Stream, StreamExt};
use futures::Stream;
use itertools::Itertools;
use log::{debug, info};
use solana_sdk::clock::Slot;