1) Switch broken tests to generate an empty tick in their ledgers to use as last_id, 2) Fix bug where PoH generator in BankingStage did not referenced the last tick instead of the last entry on startup, causing ledger verification to fail on the new tick added by the PoH generator (#1479)

This commit is contained in:
carllin
2018-10-12 00:39:10 -07:00
committed by GitHub
parent 9dd4dc2088
commit 47f69f2d24
12 changed files with 212 additions and 97 deletions

View File

@@ -430,20 +430,22 @@ pub fn set_new_leader(bank: &Bank, leader_scheduler: &mut LeaderScheduler, vote_
pub fn make_active_set_entries(
active_keypair: &Keypair,
token_source: &Keypair,
last_id: &Hash,
last_entry_id: &Hash,
last_tick_id: &Hash,
) -> Vec<Entry> {
// 1) Create transfer token entry
let transfer_tx = Transaction::system_new(&token_source, active_keypair.pubkey(), 1, *last_id);
let transfer_entry = Entry::new(last_id, 0, vec![transfer_tx]);
let last_id = transfer_entry.id;
let transfer_tx =
Transaction::system_new(&token_source, active_keypair.pubkey(), 1, *last_tick_id);
let transfer_entry = Entry::new(last_entry_id, 0, vec![transfer_tx]);
let last_entry_id = transfer_entry.id;
// 2) Create vote entry
let vote = Vote {
version: 0,
contact_info_version: 0,
};
let vote_tx = Transaction::budget_new_vote(&active_keypair, vote, last_id, 0);
let vote_entry = Entry::new(&last_id, 0, vec![vote_tx]);
let vote_tx = Transaction::budget_new_vote(&active_keypair, vote, *last_tick_id, 0);
let vote_entry = Entry::new(&last_entry_id, 0, vec![vote_tx]);
vec![transfer_entry, vote_entry]
}