Fix Tendermint deadlock (#4654)

* scope read

* consistent step
This commit is contained in:
keorn 2017-02-24 09:26:56 +00:00 committed by Gav Wood
parent 56d0ad869a
commit 9b5bcb81fd

View File

@ -151,12 +151,12 @@ impl Tendermint {
fn generate_message(&self, block_hash: Option<BlockHash>) -> Option<Bytes> {
let h = self.height.load(AtomicOrdering::SeqCst);
let r = self.view.load(AtomicOrdering::SeqCst);
let s = self.step.read();
let vote_info = message_info_rlp(&VoteStep::new(h, r, *s), block_hash);
let s = *self.step.read();
let vote_info = message_info_rlp(&VoteStep::new(h, r, s), block_hash);
match self.signer.sign(vote_info.sha3()).map(Into::into) {
Ok(signature) => {
let message_rlp = message_full_rlp(&signature, &vote_info);
let message = ConsensusMessage::new(signature, h, r, *s, block_hash);
let message = ConsensusMessage::new(signature, h, r, s, block_hash);
let validator = self.signer.address();
self.votes.vote(message.clone(), &validator);
debug!(target: "engine", "Generated {:?} as {}.", message, validator);