@@ -371,26 +371,52 @@ impl Importer {
371371        imported. len ( ) 
372372    } 
373373
374-     pub  fn  import_bootstrap_block < ' a > ( & ' a  self ,  block :  & ' a  Block ,  client :  & Client ,  _importer_lock :  & MutexGuard < ( ) > )  { 
374+     pub  fn  import_trusted_header < ' a > ( & ' a  self ,  header :  & ' a  Header ,  client :  & Client ,  _importer_lock :  & MutexGuard < ( ) > )  { 
375+         let  hash = header. hash ( ) ; 
376+         ctrace ! ( CLIENT ,  "Importing trusted header #{}-{:?}" ,  header. number( ) ,  hash) ; 
377+ 
378+         { 
379+             let  chain = client. block_chain ( ) ; 
380+             let  mut  batch = DBTransaction :: new ( ) ; 
381+             chain. insert_floating_header ( & mut  batch,  & HeaderView :: new ( & header. rlp_bytes ( ) ) ) ; 
382+             client. db ( ) . write_buffered ( batch) ; 
383+             chain. commit ( ) ; 
384+         } 
385+         client. new_headers ( & [ hash] ,  & [ ] ,  & [ ] ,  & [ ] ,  & [ ] ,  0 ,  None ) ; 
386+ 
387+         client. db ( ) . flush ( ) . expect ( "DB flush failed." ) ; 
388+     } 
389+ 
390+     pub  fn  import_trusted_block < ' a > ( & ' a  self ,  block :  & ' a  Block ,  client :  & Client ,  importer_lock :  & MutexGuard < ( ) > )  { 
375391        let  header = & block. header ; 
376392        let  hash = header. hash ( ) ; 
377-         ctrace ! ( CLIENT ,  "Importing bootstrap  block #{}-{:?}" ,  header. number( ) ,  hash) ; 
393+         ctrace ! ( CLIENT ,  "Importing trusted  block #{}-{:?}" ,  header. number( ) ,  hash) ; 
378394
395+         self . import_trusted_header ( header,  client,  importer_lock) ; 
379396        let  start = Instant :: now ( ) ; 
380397        { 
381398            let  chain = client. block_chain ( ) ; 
382399            let  mut  batch = DBTransaction :: new ( ) ; 
383-             chain. insert_bootstrap_block ( & mut  batch,  & block. rlp_bytes ( & Seal :: With ) ) ; 
400+             chain. insert_floating_block ( & mut  batch,  & block. rlp_bytes ( & Seal :: With ) ) ; 
384401            client. db ( ) . write_buffered ( batch) ; 
385402            chain. commit ( ) ; 
386403        } 
387404        let  duration = { 
388405            let  elapsed = start. elapsed ( ) ; 
389406            elapsed. as_secs ( )  *  1_000_000_000  + u64:: from ( elapsed. subsec_nanos ( ) ) 
390407        } ; 
391-         client. new_headers ( & [ hash] ,  & [ ] ,  & [ hash] ,  & [ ] ,  & [ ] ,  0 ,  Some ( hash) ) ; 
392-         self . miner . chain_new_blocks ( client,  & [ hash] ,  & [ ] ,  & [ hash] ,  & [ ] ) ; 
393-         client. new_blocks ( & [ hash] ,  & [ ] ,  & [ hash] ,  & [ ] ,  & [ ] ,  duration) ; 
408+         self . miner . chain_new_blocks ( client,  & [ hash] ,  & [ ] ,  & [ ] ,  & [ ] ) ; 
409+         client. new_blocks ( & [ hash] ,  & [ ] ,  & [ ] ,  & [ ] ,  & [ ] ,  duration) ; 
410+ 
411+         client. db ( ) . flush ( ) . expect ( "DB flush failed." ) ; 
412+     } 
413+ 
414+     pub  fn  force_update_best_block ( & self ,  hash :  & BlockHash ,  client :  & Client )  { 
415+         let  chain = client. block_chain ( ) ; 
416+         let  mut  batch = DBTransaction :: new ( ) ; 
417+         chain. force_update_best_block ( & mut  batch,  hash) ; 
418+         client. db ( ) . write_buffered ( batch) ; 
419+         chain. commit ( ) ; 
394420
395421        client. db ( ) . flush ( ) . expect ( "DB flush failed." ) ; 
396422    } 
0 commit comments