Move validator_block_0_fee_workaround into TestValidator

This commit is contained in:
Michael Vines
2020-12-10 17:40:13 -08:00
committed by mergify[bot]
parent bbad3fe501
commit 4fba7e6865
2 changed files with 24 additions and 22 deletions

View File

@ -244,6 +244,29 @@ impl TestValidator {
// test validators concurrently...
discover_cluster(&gossip, 1).expect("TestValidator startup failed");
// This is a hack to delay until the single gossip commitment fees are non-zero for test
// consistency
// (fees from genesis are zero until the first block with a transaction in it is completed)
{
let rpc_client =
RpcClient::new_with_commitment(rpc_url.clone(), CommitmentConfig::single_gossip());
let fee_rate_governor = rpc_client
.get_fee_rate_governor()
.expect("get_fee_rate_governor")
.value;
if fee_rate_governor.target_lamports_per_signature > 0 {
while rpc_client
.get_recent_blockhash()
.expect("get_recent_blockhash")
.1
.lamports_per_signature
== 0
{
sleep(Duration::from_millis(DEFAULT_MS_PER_SLOT));
}
}
}
Ok(TestValidator {
ledger_path: ledger_path.to_path_buf(),
preserve_ledger: false,