Add commitment Root variant, and add fleshed out --commitment arg to Cli (#9806)

automerge
This commit is contained in:
Tyera Eulberg
2020-04-29 22:55:33 -06:00
committed by GitHub
parent a91236012d
commit 6deaf649ef
8 changed files with 93 additions and 128 deletions

View File

@ -87,6 +87,10 @@ impl JsonRpcRequestProcessor {
let bank = r_bank_forks.working_bank();
debug!("RPC using working_bank: {:?}", bank.slot());
Ok(bank)
} else if commitment.is_some() && commitment.unwrap().commitment == CommitmentLevel::Root {
let slot = r_bank_forks.root();
debug!("RPC using node root: {:?}", slot);
Ok(r_bank_forks.get(slot).cloned().unwrap())
} else {
let cluster_root = self
.block_commitment_cache
@ -169,9 +173,7 @@ impl JsonRpcRequestProcessor {
pub fn get_epoch_schedule(&self) -> Result<EpochSchedule> {
// Since epoch schedule data comes from the genesis config, any commitment level should be
// fine
Ok(*self
.bank(Some(CommitmentConfig::recent()))?
.epoch_schedule())
Ok(*self.bank(Some(CommitmentConfig::root()))?.epoch_schedule())
}
pub fn get_balance(