Skip to content

Commit 9cf02f8

Browse files
committed
Fixed warnings
1 parent 43e26f2 commit 9cf02f8

File tree

36 files changed

+91
-137
lines changed

36 files changed

+91
-137
lines changed

blockchain-albatross/tests/history_sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use nimiq_block_albatross::{
66
PbftProposal, SignedPbftCommitMessage, SignedPbftPrepareMessage,
77
};
88
use nimiq_block_production_albatross::BlockProducer;
9-
use nimiq_blockchain_albatross::{Blockchain, Direction, PushResult};
9+
use nimiq_blockchain_albatross::{Blockchain, PushResult};
1010
use nimiq_bls::{KeyPair, SecretKey};
1111
use nimiq_database::volatile::VolatileEnvironment;
1212
use nimiq_genesis::NetworkId;

blockchain-albatross/tests/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use nimiq_block_production_albatross::BlockProducer;
1111
use nimiq_blockchain_albatross::{Blockchain, ForkEvent, PushError, PushResult};
1212
use nimiq_bls::{KeyPair, SecretKey};
1313
use nimiq_database::volatile::VolatileEnvironment;
14-
use nimiq_database::Environment;
1514
use nimiq_genesis::NetworkId;
1615
use nimiq_hash::{Blake2bHash, Hash};
1716
use nimiq_primitives::policy;
@@ -23,22 +22,20 @@ mod signed;
2322
const SECRET_KEY: &str = "196ffdb1a8acc7cbd76a251aeac0600a1d68b3aba1eba823b5e4dc5dbdcdc730afa752c05ab4f6ef8518384ad514f403c5a088a22b17bf1bc14f8ff8decc2a512c0a200f68d7bdf5a319b30356fe8d1d75ef510aed7a8660968c216c328a0000";
2423

2524
struct TemporaryBlockProducer {
26-
env: Environment,
2725
blockchain: Arc<Blockchain>,
2826
producer: BlockProducer,
2927
}
3028

3129
impl TemporaryBlockProducer {
3230
fn new() -> Self {
3331
let env = VolatileEnvironment::new(10).unwrap();
34-
let blockchain = Arc::new(Blockchain::new(env.clone(), NetworkId::UnitAlbatross).unwrap());
32+
let blockchain = Arc::new(Blockchain::new(env, NetworkId::UnitAlbatross).unwrap());
3533

3634
let keypair = KeyPair::from(
3735
SecretKey::deserialize_from_vec(&hex::decode(SECRET_KEY).unwrap()).unwrap(),
3836
);
3937
let producer = BlockProducer::new_without_mempool(Arc::clone(&blockchain), keypair);
4038
TemporaryBlockProducer {
41-
env,
4239
blockchain,
4340
producer,
4441
}
@@ -253,9 +250,8 @@ fn it_cant_rebranch_across_epochs() {
253250
let ancestor = temp_producer1.next_block(0, vec![]);
254251
temp_producer2.push(ancestor.clone()).unwrap();
255252

256-
let mut previous = ancestor;
257253
for _ in 0..policy::EPOCH_LENGTH {
258-
previous = temp_producer1.next_block(0, vec![]);
254+
temp_producer1.next_block(0, vec![]);
259255
}
260256

261257
let fork = temp_producer2.next_block(1, vec![]);

build-tools/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ rand = "0.7"
2424
rand_chacha = "0.2"
2525
serde = { version = "1.0", features = ["derive"] }
2626
shellfn = "0.1"
27-
simple_logger = "1.0"
27+
pretty_env_logger ="0.4"
2828
structopt = { version = "0.3", features = ["paw"] }
2929
toml = "0.5"
3030

build-tools/src/devnet/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
99
use std::sync::Arc;
1010

1111
use failure::Error;
12-
use log::Level;
1312
use structopt::StructOpt;
1413

1514
use docker::Docker;
@@ -74,7 +73,7 @@ fn run_devnet(args: Args, keyboard_interrupt: Arc<AtomicBool>) -> Result<(), Err
7473

7574
#[paw::main]
7675
fn main(args: Args) {
77-
simple_logger::init_with_level(Level::Info).expect("Failed to initialize logging");
76+
pretty_env_logger::init();
7877

7978
debug!("{:#?}", args);
8079

build-tools/src/genesis/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::env;
22
use std::process::exit;
33

4-
use log::Level;
5-
64
use nimiq_build_tools::genesis::{GenesisBuilder, GenesisInfo};
75

86
fn usage(args: Vec<String>) -> ! {
@@ -14,7 +12,7 @@ fn usage(args: Vec<String>) -> ! {
1412
}
1513

1614
fn main() {
17-
simple_logger::init_with_level(Level::Debug).expect("Failed to initialize logging");
15+
pretty_env_logger::init();
1816

1917
let args = env::args().collect::<Vec<String>>();
2018

client/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ extern crate nimiq_lib as nimiq;
55
use std::convert::TryFrom;
66
use std::time::Duration;
77

8-
use futures::{future, FutureExt, StreamExt, TryFutureExt};
9-
use tokio::runtime::Runtime;
10-
118
use nimiq::extras::deadlock::initialize_deadlock_detection;
129
use nimiq::extras::logging::{initialize_logging, log_error_cause_chain};
1310
use nimiq::extras::panic::initialize_panic_reporting;
@@ -77,7 +74,9 @@ async fn main_inner() -> Result<(), Error> {
7774
pkcs12_key_file.display()
7875
)
7976
});
80-
let metrics_server = initialize_metrics_server(
77+
78+
// FIXME: Spawn `metrics_server` (which is a IntoFuture)
79+
let _metrics_server = initialize_metrics_server(
8180
&client,
8281
metrics_config,
8382
pkcs12_key_file,
@@ -120,8 +119,6 @@ async fn main_inner() -> Result<(), Error> {
120119
);
121120
}
122121
}
123-
124-
Ok(())
125122
}
126123

127124
#[tokio::main]

consensus-albatross/src/consensus/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use network_interface::{
2222
};
2323
use transaction::Transaction;
2424
use utils::mutable_once::MutableOnce;
25-
use utils::timers::Timers;
2625

2726
use crate::consensus_agent::ConsensusAgent;
2827
use crate::error::{Error, SyncError};
@@ -59,7 +58,7 @@ pub struct Consensus<N: Network> {
5958
pub network: Arc<N>,
6059
pub env: Environment,
6160

62-
timers: Timers<ConsensusTimer>,
61+
//timers: Timers<ConsensusTimer>,
6362

6463
pub(crate) state: RwLock<ConsensusState<N>>,
6564

@@ -69,10 +68,10 @@ pub struct Consensus<N: Network> {
6968
sync_protocol: Box<dyn SyncProtocol<N>>,
7069
}
7170

72-
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
71+
/*#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
7372
enum ConsensusTimer {
7473
Sync,
75-
}
74+
}*/
7675

7776
type ConsensusAgentMap<P> = HashMap<Arc<P>, Arc<ConsensusAgent<P>>>;
7877

@@ -98,7 +97,7 @@ impl<N: Network> Consensus<N> {
9897
network,
9998
env,
10099

101-
timers: Timers::new(),
100+
//timers: Timers::new(),
102101

103102
state: RwLock::new(ConsensusState {
104103
agents: HashMap::new(),
@@ -172,7 +171,7 @@ impl<N: Network> Consensus<N> {
172171
let agent = Arc::new(ConsensusAgent::new(Arc::clone(&peer)));
173172
self.state.write().agents.insert(peer, Arc::clone(&agent));
174173

175-
self.events.send(ConsensusEvent::PeerJoined(agent));
174+
self.events.send(ConsensusEvent::PeerJoined(agent)).unwrap_or_else(|_| panic!(""));
176175
}
177176

178177
fn on_peer_left(&self, peer: Arc<N::PeerType>) {

consensus-albatross/src/consensus/request_response.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ use futures::StreamExt;
44

55
use crate::messages::handlers::Handle;
66
use crate::messages::{
7-
BlockHashes, Epoch, RequestBlockHashes, RequestBlockHashesFilter, RequestEpoch,
7+
RequestBlockHashes, RequestEpoch,
88
RequestHistoryChunk,
99
};
1010
use crate::Consensus;
1111

12-
use block_albatross::Block;
13-
use blockchain_albatross::{Blockchain, Direction};
14-
use network_interface::prelude::{Network, Peer, ResponseMessage};
15-
use nimiq_genesis::NetworkInfo;
16-
use primitives::policy;
12+
use blockchain_albatross::Blockchain;
13+
use network_interface::prelude::{Network, Peer};
14+
1715

1816
impl<N: Network> Consensus<N> {
1917
pub(super) fn init_network_requests(network: &Arc<N>, blockchain: &Arc<Blockchain>) {

consensus-albatross/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(dead_code)]
2+
13
#[macro_use]
24
extern crate beserial_derive;
35
#[macro_use]

consensus-albatross/src/messages/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use failure::_core::fmt::{Error, Formatter};
55
use hash::Blake2bHash;
66
use network_interface::message::*;
77
use std::fmt::Debug;
8-
use transaction::Transaction;
98

109
use crate::request_response;
1110

@@ -134,7 +133,7 @@ impl Message for HistoryChunk {
134133
}
135134

136135
impl Debug for HistoryChunk {
137-
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
136+
fn fmt(&self, _f: &mut Formatter<'_>) -> Result<(), Error> {
138137
unimplemented!()
139138
}
140139
}

0 commit comments

Comments
 (0)