fix compilation
This commit is contained in:
parent
2fa34fd6a8
commit
3b0d5503b1
@ -41,7 +41,7 @@ use evm::Schedule;
|
||||
use io::{IoService, IoChannel};
|
||||
use service::ClientIoMessage;
|
||||
use self::message::ConsensusMessage;
|
||||
use self::timeout::{TimerHandler, NextStep};
|
||||
use self::timeout::{TransitionHandler, NextStep};
|
||||
use self::params::TendermintParams;
|
||||
use self::vote_collector::VoteCollector;
|
||||
|
||||
@ -102,7 +102,7 @@ impl Tendermint {
|
||||
proposed_block: Mutex::new(None),
|
||||
message_channel: Mutex::new(None)
|
||||
});
|
||||
let handler = TimerHandler { engine: Arc::downgrade(&engine) };
|
||||
let handler = TransitionHandler { engine: Arc::downgrade(&engine) };
|
||||
try!(engine.step_service.register_handler(Arc::new(handler)));
|
||||
Ok(engine)
|
||||
}
|
||||
@ -241,7 +241,7 @@ impl Engine for Tendermint {
|
||||
if let Ok(signature) = ap.sign(*author, None, block_hash(header)) {
|
||||
return Some(vec![
|
||||
::rlp::encode(&self.round.load(AtomicOrdering::SeqCst)).to_vec(),
|
||||
::rlp::encode(&signature.into()).to_vec(),
|
||||
::rlp::encode(&H520::from(signature)).to_vec(),
|
||||
Vec::new()
|
||||
])
|
||||
} else {
|
||||
@ -271,10 +271,12 @@ impl Engine for Tendermint {
|
||||
if votes.len() > self.threshold() {
|
||||
}
|
||||
},
|
||||
Step::Precommit => ,
|
||||
Step::Precommit => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
self.votes.vote(message, sender);
|
||||
Err(BlockError::InvalidSeal.into())
|
||||
}
|
||||
|
||||
fn verify_block_basic(&self, header: &Header, _block: Option<&[u8]>) -> Result<(), Error> {
|
||||
|
@ -16,16 +16,14 @@
|
||||
|
||||
//! Tendermint timeout handling.
|
||||
|
||||
use util::Mutex;
|
||||
use std::sync::atomic::{Ordering as AtomicOrdering};
|
||||
use std::sync::Weak;
|
||||
use io::{IoContext, IoHandler, TimerToken, IoChannel};
|
||||
use io::{IoContext, IoHandler, TimerToken};
|
||||
use super::{Tendermint, Step};
|
||||
use time::{get_time, Duration};
|
||||
use service::ClientIoMessage;
|
||||
use time::Duration;
|
||||
|
||||
pub struct TimerHandler {
|
||||
engine: Weak<Tendermint>,
|
||||
pub struct TransitionHandler {
|
||||
pub engine: Weak<Tendermint>,
|
||||
}
|
||||
|
||||
/// Base timeout of each step in ms.
|
||||
@ -70,7 +68,7 @@ fn set_timeout(io: &IoContext<NextStep>, timeout: Duration) {
|
||||
.unwrap_or_else(|e| warn!(target: "poa", "Failed to set consensus step timeout: {}.", e))
|
||||
}
|
||||
|
||||
impl IoHandler<NextStep> for TimerHandler {
|
||||
impl IoHandler<NextStep> for TransitionHandler {
|
||||
fn initialize(&self, io: &IoContext<NextStep>) {
|
||||
if let Some(engine) = self.engine.upgrade() {
|
||||
set_timeout(io, engine.our_params.timeouts.propose)
|
||||
@ -104,7 +102,7 @@ impl IoHandler<NextStep> for TimerHandler {
|
||||
};
|
||||
|
||||
if let Some(step) = next_step {
|
||||
*engine.step.write() = step;
|
||||
*engine.step.write() = step.clone();
|
||||
if step == Step::Propose {
|
||||
engine.update_sealing();
|
||||
}
|
||||
@ -115,9 +113,12 @@ impl IoHandler<NextStep> for TimerHandler {
|
||||
|
||||
fn message(&self, io: &IoContext<NextStep>, message: &NextStep) {
|
||||
if let Some(engine) = self.engine.upgrade() {
|
||||
io.clear_timer(ENGINE_TIMEOUT_TOKEN);
|
||||
let NextStep(next_step) = *message;
|
||||
*engine.step.write() = next_step;
|
||||
match io.clear_timer(ENGINE_TIMEOUT_TOKEN) {
|
||||
Ok(_) => {},
|
||||
Err(io_err) => warn!(target: "poa", "Could not remove consensus timer {}.", io_err),
|
||||
};
|
||||
let NextStep(next_step) = message.clone();
|
||||
*engine.step.write() = next_step.clone();
|
||||
match next_step {
|
||||
Step::Propose => {
|
||||
engine.update_sealing();
|
||||
|
@ -280,7 +280,7 @@ impl ChainNotify for EthSync {
|
||||
}
|
||||
|
||||
fn stop(&self) {
|
||||
self.handler.snapshot_service.abort_restore();
|
||||
self.eth_handler.snapshot_service.abort_restore();
|
||||
self.network.stop().unwrap_or_else(|e| warn!("Error stopping network: {:?}", e));
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ const GENERIC_PACKET: u8 = 0x01;
|
||||
pub struct NetworkStatus {
|
||||
pub protocol_version: u8,
|
||||
/// The underlying p2p network version.
|
||||
pub network_id: U256,
|
||||
pub network_id: usize,
|
||||
/// Total number of connected peers
|
||||
pub num_peers: usize,
|
||||
/// Total number of active peers
|
||||
@ -52,7 +52,7 @@ struct PeerInfo {
|
||||
/// Peer chain genesis hash
|
||||
genesis: H256,
|
||||
/// Peer network id
|
||||
network_id: U256,
|
||||
network_id: usize,
|
||||
}
|
||||
|
||||
/// Infinity protocol handler.
|
||||
@ -61,7 +61,7 @@ pub struct InfinitySync {
|
||||
/// All connected peers
|
||||
peers: HashMap<PeerId, PeerInfo>,
|
||||
/// Network ID
|
||||
network_id: U256,
|
||||
network_id: usize,
|
||||
}
|
||||
|
||||
impl InfinitySync {
|
||||
|
Loading…
Reference in New Issue
Block a user