cleanup unused function (#4064)
This commit is contained in:
parent
fabba82173
commit
c2193a37ce
|
@ -1026,24 +1026,6 @@ impl Bank {
|
|||
// Register a bogus executable account, which will be loaded and ignored.
|
||||
self.register_native_instruction_processor("", &program_id);
|
||||
}
|
||||
|
||||
pub fn is_in_subtree_of(&self, parent: u64) -> bool {
|
||||
if self.slot() == parent {
|
||||
return true;
|
||||
}
|
||||
let mut next_parent = self.parent();
|
||||
|
||||
while let Some(p) = next_parent {
|
||||
if p.slot() == parent {
|
||||
return true;
|
||||
} else if p.slot() < parent {
|
||||
return false;
|
||||
}
|
||||
next_parent = p.parent();
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Bank {
|
||||
|
@ -1841,30 +1823,6 @@ mod tests {
|
|||
assert_eq!(bank.is_votable(), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_in_subtree_of() {
|
||||
let (genesis_block, _) = GenesisBlock::new(1);
|
||||
let parent = Arc::new(Bank::new(&genesis_block));
|
||||
// Bank 1
|
||||
let bank = Arc::new(new_from_parent(&parent));
|
||||
// Bank 2
|
||||
let bank2 = new_from_parent(&bank);
|
||||
// Bank 5
|
||||
let bank5 = Bank::new_from_parent(&bank, &Pubkey::default(), 5);
|
||||
|
||||
// Parents of bank 2: 0 -> 1 -> 2
|
||||
assert!(bank2.is_in_subtree_of(0));
|
||||
assert!(bank2.is_in_subtree_of(1));
|
||||
assert!(bank2.is_in_subtree_of(2));
|
||||
assert!(!bank2.is_in_subtree_of(3));
|
||||
|
||||
// Parents of bank 5: 0 -> 1 -> 5
|
||||
assert!(bank5.is_in_subtree_of(0));
|
||||
assert!(bank5.is_in_subtree_of(1));
|
||||
assert!(!bank5.is_in_subtree_of(2));
|
||||
assert!(!bank5.is_in_subtree_of(4));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bank_inherit_tx_count() {
|
||||
let (genesis_block, mint_keypair) = GenesisBlock::new(500);
|
||||
|
|
Loading…
Reference in New Issue