Skip to content

Commit 8fc767d

Browse files
Hyunsik Jeongsgkim126
authored andcommitted
Remove broadcast_proposal_block from ConsensusEngine trait
1 parent b262e66 commit 8fc767d

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

core/src/client/importer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ impl Importer {
113113
}
114114
if let Ok(closed_block) = self.check_and_close_block(&block, client) {
115115
if self.engine.is_proposal(&block.header) {
116-
self.engine.on_verified_proposal(encoded::Block::new(block.bytes.clone()));
117-
self.engine.broadcast_proposal_block(encoded::Block::new(block.bytes.clone()))
116+
self.engine.on_verified_proposal(encoded::Block::new(block.bytes.clone()))
118117
}
119118

120119
imported_blocks.push(header.hash());

core/src/consensus/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ pub trait ConsensusEngine<M: Machine>: Sync + Send {
274274
/// Consensus many hold the verified proposal block until it should be imported.
275275
fn on_verified_proposal(&self, _verified_block_data: encoded::Block) {}
276276

277-
/// Broadcast a block proposal.
278-
fn broadcast_proposal_block(&self, _block: encoded::Block) {}
279-
280277
/// Register an account which signs consensus messages.
281278
fn set_signer(&self, _ap: Arc<AccountProvider>, _address: Address, _password: Option<Password>) {}
282279

core/src/consensus/tendermint/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,11 @@ impl TendermintInner {
722722
header
723723
);
724724
self.move_to_step(Step::Prevote);
725+
self.broadcast_proposal_block(encoded::Block::new(sealed_block.rlp_bytes()));
726+
}
727+
728+
fn on_verified_proposal(&self, verified_block_data: encoded::Block) {
729+
self.broadcast_proposal_block(verified_block_data);
725730
}
726731

727732
fn verify_block_basic(&self, header: &Header) -> Result<(), Error> {
@@ -1202,9 +1207,9 @@ impl ConsensusEngine<CodeChainMachine> for Tendermint {
12021207
guard.is_proposal(header)
12031208
}
12041209

1205-
fn broadcast_proposal_block(&self, block: encoded::Block) {
1210+
fn on_verified_proposal(&self, verified_block_data: encoded::Block) {
12061211
let guard = self.inner.lock();
1207-
guard.broadcast_proposal_block(block)
1212+
guard.on_verified_proposal(verified_block_data)
12081213
}
12091214

12101215
fn set_signer(&self, ap: Arc<AccountProvider>, address: Address, password: Option<Password>) {

core/src/miner/miner.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ use crate::client::{
4141
ResealTimer,
4242
};
4343
use crate::consensus::{CodeChainEngine, EngineType};
44-
use crate::encoded;
4544
use crate::error::Error;
4645
use crate::header::Header;
4746
use crate::scheme::Scheme;
@@ -528,7 +527,6 @@ impl Miner {
528527
.map(|sealed| {
529528
let import_result = chain.import_sealed_block(&sealed);
530529
self.engine.proposal_generated(&sealed);
531-
self.engine.broadcast_proposal_block(encoded::Block::new(sealed.rlp_bytes()));
532530
import_result.is_ok()
533531
})
534532
.unwrap_or_else(|e| {

0 commit comments

Comments
 (0)