Changed transition to restart Rpu rather than modify bank to prevent lock contention

This commit is contained in:
Carl
2018-09-18 17:35:09 -07:00
committed by Greg Fitzgerald
parent 8c8a4ba705
commit cd2d50e06c
4 changed files with 82 additions and 39 deletions

View File

@ -810,18 +810,29 @@ fn test_leader_to_validator_transition() {
// make sure the leader stops.
assert!(genesis_height < leader_rotation_interval);
for i in genesis_height..(leader_rotation_interval + extra_transactions) {
let expected_balance = std::cmp::min(
leader_rotation_interval - genesis_height,
i - genesis_height,
);
if i < leader_rotation_interval {
// Poll to see that the bank state is updated after every transaction
// to ensure that each transaction is packaged as a single entry,
// so that we can be sure leader rotation is triggered
let expected_balance = std::cmp::min(
leader_rotation_interval - genesis_height,
i - genesis_height + 1,
);
let result = send_tx_and_retry_get_balance(
&leader_info,
&mint,
&bob_pubkey,
1,
Some(expected_balance as i64),
);
send_tx_and_retry_get_balance(
&leader_info,
&mint,
&bob_pubkey,
1,
Some(expected_balance as i64),
);
assert_eq!(result, Some(expected_balance as i64))
} else {
// After leader_rotation_interval entries, we don't care about the
// number of entries generated by these transactions. These are just
// here for testing to make sure the leader stopped at the correct point.
send_tx_and_retry_get_balance(&leader_info, &mint, &bob_pubkey, 1, None);
}
}
// Wait for leader to shut down tpu and restart tvu