@@ -389,42 +389,6 @@ impl LightBlockchain {
389389 Ok ( PushResult :: Rebranched )
390390 }
391391
392- /// Pushes an election block backwards into the chain. This pushes the election block immediately
393- /// before the oldest election block that we have. It is useful in case we need to receive a proof
394- /// for a transaction in a past epoch, in that case the simplest course of action is to "walk"
395- /// backwards from our current election block until we get to the desired epoch.
396- pub fn push_election_backwards (
397- this : RwLockUpgradableReadGuard < Self > ,
398- header : MacroHeader ,
399- ) -> Result < PushResult , PushError > {
400- // Get epoch number.
401- let epoch = Policy :: epoch_at ( header. block_number ) ;
402-
403- // Check if we already know this block.
404- if this. chain_store . get_election ( epoch) . is_some ( ) {
405- return Ok ( PushResult :: Known ) ;
406- }
407-
408- // Check if we have this block's successor.
409- let prev_block = this
410- . chain_store
411- . get_election ( epoch + Policy :: blocks_per_epoch ( ) )
412- . ok_or ( PushError :: InvalidSuccessor ) ?;
413-
414- // Verify that the block is indeed the predecessor.
415- if header. hash ( ) != prev_block. parent_election_hash {
416- return Err ( PushError :: InvalidPredecessor ) ;
417- }
418-
419- // Upgrade the blockchain lock
420- let mut this = RwLockUpgradableReadGuard :: upgrade ( this) ;
421-
422- // Store the election block header.
423- this. chain_store . put_election ( header) ;
424-
425- Ok ( PushResult :: Extended )
426- }
427-
428392 fn detect_forks ( & self , block : & MicroBlock , validator_address : & Address ) {
429393 assert ! ( !block. is_skip_block( ) ) ;
430394
0 commit comments