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

automerge
This commit is contained in:
mergify[bot]
2020-04-30 12:49:36 -07:00
committed by GitHub
parent b4933f4c74
commit c63bd05458
8 changed files with 86 additions and 101 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(