nicer tracing
This commit is contained in:
parent
a4bf914683
commit
3c5d5856d2
@ -169,7 +169,7 @@ impl Tendermint {
|
||||
let message_rlp = message_full_rlp(&signature, &vote_info);
|
||||
let message = ConsensusMessage::new(signature, h, r, *s, block_hash);
|
||||
self.votes.vote(message.clone(), *authority);
|
||||
debug!(target: "poa", "Generated a message: {:?}.", message);
|
||||
debug!(target: "poa", "Generated {:?} as {}.", message, *authority);
|
||||
self.handle_valid_message(&message);
|
||||
|
||||
Some(message_rlp)
|
||||
@ -362,7 +362,7 @@ impl Tendermint {
|
||||
};
|
||||
|
||||
if let Some(step) = next_step {
|
||||
trace!(target: "poa", "handle_valid_message: Transition triggered.");
|
||||
trace!(target: "poa", "handle_valid_message: Transition to {:?} triggered.", step);
|
||||
self.to_step(step);
|
||||
}
|
||||
}
|
||||
@ -457,13 +457,10 @@ impl Engine for Tendermint {
|
||||
if !self.is_authority(&sender) {
|
||||
try!(Err(EngineError::NotAuthorized(sender)));
|
||||
}
|
||||
|
||||
self.votes.vote(message.clone(), sender);
|
||||
self.broadcast_message(rlp.as_raw().to_vec());
|
||||
trace!(target: "poa", "Handling a valid message: {:?}", message);
|
||||
trace!(target: "poa", "Handling a valid {:?} from {}.", message, sender);
|
||||
self.votes.vote(message.clone(), sender);
|
||||
self.handle_valid_message(&message);
|
||||
} else {
|
||||
trace!(target: "poa", "handle_message: Old or known message ignored: {:?}.", message);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -49,10 +49,10 @@ impl TendermintTimeouts {
|
||||
impl Default for TendermintTimeouts {
|
||||
fn default() -> Self {
|
||||
TendermintTimeouts {
|
||||
propose: Duration::milliseconds(2000),
|
||||
prevote: Duration::milliseconds(2000),
|
||||
precommit: Duration::milliseconds(2000),
|
||||
commit: Duration::milliseconds(2000),
|
||||
propose: Duration::milliseconds(10000),
|
||||
prevote: Duration::milliseconds(10000),
|
||||
precommit: Duration::milliseconds(10000),
|
||||
commit: Duration::milliseconds(10000),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,10 +62,14 @@ impl VoteCollector {
|
||||
}
|
||||
|
||||
pub fn is_old_or_known(&self, message: &ConsensusMessage) -> bool {
|
||||
self.votes.read().contains_key(message)
|
||||
|| {
|
||||
self.votes.read().get(message).map_or(false, |a| {
|
||||
trace!(target: "poa", "Known message from {}: {:?}.", a, message);
|
||||
true
|
||||
}) || {
|
||||
let guard = self.votes.read();
|
||||
guard.keys().next().map_or(true, |oldest| message <= oldest)
|
||||
let is_old = guard.keys().next().map_or(true, |oldest| message <= oldest);
|
||||
if is_old { trace!(target: "poa", "Old message {:?}.", message); }
|
||||
is_old
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user