diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index bf9a4096b7..7f596b0556 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -3256,11 +3256,6 @@ impl Blockstore { Ok(()) } - /// For tests - pub fn set_last_root(&mut self, root: Slot) { - *self.last_root.write().unwrap() = root; - } - pub fn mark_slots_as_if_rooted_normally_at_startup( &self, slots: Vec<(Slot, Option)>, diff --git a/local-cluster/src/integration_tests.rs b/local-cluster/src/integration_tests.rs index 41e803799f..26d87d0d39 100644 --- a/local-cluster/src/integration_tests.rs +++ b/local-cluster/src/integration_tests.rs @@ -171,13 +171,15 @@ pub fn wait_for_duplicate_proof(ledger_path: &Path, dup_slot: Slot) -> Option= latest root check; + // this check would otherwise prevent the pruned fork from being inserted let minority_blockstore = open_blockstore(&minority_validator_info.info.ledger_path); - let mut our_blockstore = open_blockstore(&our_node_info.info.ledger_path); - our_blockstore.set_last_root(fork_slot - 1); - copy_blocks(last_minority_vote, &minority_blockstore, &our_blockstore); + let our_blockstore = open_blockstore(&our_node_info.info.ledger_path); + copy_blocks( + last_minority_vote, + &minority_blockstore, + &our_blockstore, + true, + ); // Change last block parent to chain off of (purged) minority fork info!("For our node, changing parent of {last_majority_vote} to {last_minority_vote}"); @@ -4737,9 +4744,6 @@ fn test_duplicate_with_pruned_ancestor() { true, // merkle_variant ); our_blockstore.insert_shreds(shreds, None, false).unwrap(); - - // Update the root to set minority fork back as pruned - our_blockstore.set_last_root(fork_slot + fork_length); } // Actual test, `our_node` will replay the minority fork, then the majority fork which will @@ -5320,7 +5324,7 @@ fn test_duplicate_shreds_switch_failure() { { let blockstore1 = open_blockstore(&duplicate_leader_ledger_path); let blockstore2 = open_blockstore(&target_switch_fork_validator_ledger_path); - copy_blocks(dup_slot, &blockstore1, &blockstore2); + copy_blocks(dup_slot, &blockstore1, &blockstore2, false); } clear_ledger_and_tower( &target_switch_fork_validator_ledger_path, @@ -5353,7 +5357,7 @@ fn test_duplicate_shreds_switch_failure() { { let blockstore1 = open_blockstore(&duplicate_fork_validator1_ledger_path); let blockstore2 = open_blockstore(&duplicate_fork_validator2_ledger_path); - copy_blocks(dup_slot, &blockstore1, &blockstore2); + copy_blocks(dup_slot, &blockstore1, &blockstore2, false); } // Set entrypoint to `target_switch_fork_validator_pubkey` so we can run discovery in gossip even without the