@@ -11,7 +11,8 @@ use crate::{
1111 traits:: { EngineClient , ForceUpdateSealing } ,
1212 } ,
1313 engines:: {
14- Engine , EngineError , ForkChoice , Seal , SealingState , default_system_or_code_call,
14+ BlockAuthorOption , Engine , EngineError , ForkChoice , Seal , SealingState ,
15+ default_system_or_code_call,
1516 hbbft:: {
1617 contracts:: random_hbbft:: set_current_seed_tx_raw, hbbft_message_memorium:: BadSealReason ,
1718 } ,
@@ -595,14 +596,9 @@ impl HoneyBadgerBFT {
595596 . write ( )
596597 . insert ( batch. epoch , random_number) ;
597598
598- if let Some ( mut header) = client. create_pending_block_at ( batch_txns, timestamp, batch. epoch ) {
599+ if let Some ( header) = client. create_pending_block_at ( batch_txns, timestamp, batch. epoch ) {
599600 let block_num = header. number ( ) ;
600601 let hash = header. bare_hash ( ) ;
601- if let Some ( reward_contract_address) = self . params . block_reward_contract_address {
602- header. set_author ( reward_contract_address) ;
603- } else {
604- warn ! ( "Creating block with no blockRewardContractAddress {}" , block_num) ;
605- }
606602 // TODO: trace is missleading here: we already got the signature shares, we can already
607603 trace ! ( target: "consensus" , "Sending signature share of {} for block {}" , hash, block_num) ;
608604 let step = match self
@@ -795,7 +791,7 @@ impl HoneyBadgerBFT {
795791 . map ( |msg| msg. map ( |m| Message :: Sealing ( block_num, m) ) ) ;
796792 self . dispatch_messages ( & client, messages, network_info) ;
797793 if let Some ( sig) = step. output . into_iter ( ) . next ( ) {
798- trace ! ( target: "consensus" , "Signature for block {} is ready" , block_num) ;
794+ trace ! ( target: "consensus" , "Signature for block {} is ready. " , block_num) ;
799795 let state = Sealing :: Complete ( sig) ;
800796 self . sealing . write ( ) . insert ( block_num, state) ;
801797
@@ -1473,8 +1469,11 @@ impl Engine<EthereumMachine> for HoneyBadgerBFT {
14731469 false
14741470 }
14751471
1476- fn use_block_author ( & self ) -> bool {
1477- true
1472+ fn use_block_author ( & self ) -> BlockAuthorOption {
1473+ if let Some ( address) = self . params . block_reward_contract_address {
1474+ return BlockAuthorOption :: EngineBlockAuthor ( address) ;
1475+ }
1476+ return BlockAuthorOption :: ConfiguredBlockAuthor ;
14781477 }
14791478
14801479 fn on_before_transactions ( & self , block : & mut ExecutedBlock ) -> Result < ( ) , Error > {
@@ -1542,7 +1541,7 @@ impl Engine<EthereumMachine> for HoneyBadgerBFT {
15421541
15431542 /// Allow mutating the header during seal generation.
15441543 fn on_seal_block ( & self , block : & mut ExecutedBlock ) -> Result < ( ) , Error > {
1545- let random_numbers = self . random_numbers . read ( ) ;
1544+ let random_numbers = self . random_numbers . read ( ) ;
15461545 match random_numbers. get ( & block. header . number ( ) ) {
15471546 None => {
15481547 warn ! ( "No rng value available for header." ) ;
@@ -1563,7 +1562,6 @@ impl Engine<EthereumMachine> for HoneyBadgerBFT {
15631562 if let Some ( address) = self . params . block_reward_contract_address {
15641563 // only if no block reward skips are defined for this block.
15651564 let header_number = block. header . number ( ) ;
1566- block. header . set_author ( address) ;
15671565
15681566 if self
15691567 . params
0 commit comments