Skip to content

Commit 70373d6

Browse files
foriequal0mergify[bot]
authored andcommitted
Remove generic parameter of solo consensus
1 parent 1e0ccbd commit 70373d6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

core/src/consensus/solo/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ mod params;
1919
use std::sync::Arc;
2020

2121
use cstate::{ActionHandler, HitHandler};
22-
use ctypes::machine::{Header, LiveBlock, Transactions, WithBalances};
22+
use ctypes::machine::WithBalances;
2323

2424
use self::params::SoloParams;
2525
use super::{ConsensusEngine, Seal};
26+
use crate::block::{ExecutedBlock, IsBlock};
27+
use crate::codechain_machine::CodeChainMachine;
2628
use crate::consensus::EngineType;
27-
use crate::SignedTransaction;
29+
use crate::error::Error;
30+
use crate::header::Header;
2831

2932
/// A consensus engine which does not provide any consensus mechanism.
3033
pub struct Solo<M> {
@@ -49,15 +52,12 @@ impl<M> Solo<M> {
4952
}
5053
}
5154

52-
impl<M: WithBalances> ConsensusEngine<M> for Solo<M>
53-
where
54-
M::LiveBlock: Transactions<Transaction = SignedTransaction>,
55-
{
55+
impl ConsensusEngine<CodeChainMachine> for Solo<CodeChainMachine> {
5656
fn name(&self) -> &str {
5757
"Solo"
5858
}
5959

60-
fn machine(&self) -> &M {
60+
fn machine(&self) -> &CodeChainMachine {
6161
&self.machine
6262
}
6363

@@ -69,16 +69,16 @@ where
6969
EngineType::Solo
7070
}
7171

72-
fn generate_seal(&self, _block: &M::LiveBlock, _parent: &M::Header) -> Seal {
72+
fn generate_seal(&self, _block: &ExecutedBlock, _parent: &Header) -> Seal {
7373
Seal::Solo
7474
}
7575

76-
fn verify_local_seal(&self, _header: &M::Header) -> Result<(), M::Error> {
76+
fn verify_local_seal(&self, _header: &Header) -> Result<(), Error> {
7777
Ok(())
7878
}
7979

80-
fn on_close_block(&self, block: &mut M::LiveBlock) -> Result<(), M::Error> {
81-
let author = *LiveBlock::header(&*block).author();
80+
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error> {
81+
let author = *block.header().author();
8282
let total_reward = self.block_reward(block.header().number())
8383
+ self.block_fee(Box::new(block.transactions().to_owned().into_iter().map(Into::into)));
8484
self.machine.add_balance(block, &author, total_reward)

0 commit comments

Comments
 (0)