Skip to content

Commit 4630e1a

Browse files
viquezclaudiojsdanielh
authored andcommitted
Removes unused function in light-blockchain
1 parent ed87788 commit 4630e1a

1 file changed

Lines changed: 0 additions & 36 deletions

File tree

light-blockchain/src/push.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)