dont rebroadcast propose
This commit is contained in:
parent
aa9caac750
commit
347634ac6c
@ -52,6 +52,15 @@ pub enum Step {
|
||||
Commit
|
||||
}
|
||||
|
||||
impl Step {
|
||||
pub fn is_pre(self) -> bool {
|
||||
match self {
|
||||
Step::Prevote | Step::Precommit => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type Height = usize;
|
||||
pub type Round = usize;
|
||||
pub type BlockHash = H256;
|
||||
|
@ -125,7 +125,12 @@ impl VoteCollector {
|
||||
|
||||
pub fn get_up_to(&self, height: Height) -> Vec<Bytes> {
|
||||
let guard = self.votes.read();
|
||||
guard.keys().take_while(|m| m.height <= height).map(|m| ::rlp::encode(m).to_vec()).collect()
|
||||
guard
|
||||
.keys()
|
||||
.filter(|m| m.step.is_pre())
|
||||
.take_while(|m| m.height <= height)
|
||||
.map(|m| ::rlp::encode(m).to_vec())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,9 +480,11 @@ impl Miner {
|
||||
|
||||
/// Uses Engine to seal the block internally and then imports it to chain.
|
||||
fn seal_and_import_block_internally(&self, chain: &MiningBlockChainClient, block: ClosedBlock) -> bool {
|
||||
let mut sealing_work = self.sealing_work.lock();
|
||||
sealing_work.queue.push(block.clone());
|
||||
sealing_work.queue.use_last_ref();
|
||||
{
|
||||
let mut sealing_work = self.sealing_work.lock();
|
||||
sealing_work.queue.push(block.clone());
|
||||
sealing_work.queue.use_last_ref();
|
||||
}
|
||||
if !block.transactions().is_empty() || self.forced_sealing() {
|
||||
if let Ok(sealed) = self.seal_block_internally(block) {
|
||||
if chain.import_sealed_block(sealed).is_ok() {
|
||||
|
Loading…
Reference in New Issue
Block a user