@@ -60,6 +60,7 @@ impl std::convert::From<Error> for ConsensusError {
6060pub struct FrontierBlockImport < B : BlockT , I , C > {
6161 inner : I ,
6262 client : Arc < C > ,
63+ enabled : bool ,
6364 _marker : PhantomData < B > ,
6465}
6566
@@ -68,6 +69,7 @@ impl<Block: BlockT, I: Clone + BlockImport<Block>, C> Clone for FrontierBlockImp
6869 FrontierBlockImport {
6970 inner : self . inner . clone ( ) ,
7071 client : self . client . clone ( ) ,
72+ enabled : self . enabled ,
7173 _marker : PhantomData ,
7274 }
7375 }
@@ -83,10 +85,12 @@ impl<B, I, C> FrontierBlockImport<B, I, C> where
8385 pub fn new (
8486 inner : I ,
8587 client : Arc < C > ,
88+ enabled : bool ,
8689 ) -> Self {
8790 Self {
8891 inner,
8992 client,
93+ enabled,
9094 _marker : PhantomData ,
9195 }
9296 }
@@ -122,23 +126,25 @@ impl<B, I, C> BlockImport<B> for FrontierBlockImport<B, I, C> where
122126 )
123127 }
124128
125- let log = find_frontier_log :: < B > ( & block. header ) ?;
126- let hash = block. post_hash ( ) ;
127-
128- match log {
129- ConsensusLog :: EndBlock {
130- block_hash, transaction_hashes,
131- } => {
132- aux_schema:: write_block_hash ( block_hash, hash, insert_closure ! ( ) ) ;
133-
134- for ( index, transaction_hash) in transaction_hashes. into_iter ( ) . enumerate ( ) {
135- aux_schema:: write_transaction_metadata (
136- transaction_hash,
137- ( block_hash, index as u32 ) ,
138- insert_closure ! ( ) ,
139- ) ;
140- }
141- } ,
129+ if self . enabled {
130+ let log = find_frontier_log :: < B > ( & block. header ) ?;
131+ let hash = block. post_hash ( ) ;
132+
133+ match log {
134+ ConsensusLog :: EndBlock {
135+ block_hash, transaction_hashes,
136+ } => {
137+ aux_schema:: write_block_hash ( block_hash, hash, insert_closure ! ( ) ) ;
138+
139+ for ( index, transaction_hash) in transaction_hashes. into_iter ( ) . enumerate ( ) {
140+ aux_schema:: write_transaction_metadata (
141+ transaction_hash,
142+ ( block_hash, index as u32 ) ,
143+ insert_closure ! ( ) ,
144+ ) ;
145+ }
146+ } ,
147+ }
142148 }
143149
144150 self . inner . import_block ( block, new_cache) . map_err ( Into :: into)
0 commit comments