Add commitment parameter to getFeeCalculatorForBlockhash (#10255)

* Accept commitment parameter on getFeeCalculatorForBlockhash

* Update docs

* Add get_fee_calculator_for_blockhash_with_commitment to rpc client
This commit is contained in:
Tyera Eulberg
2020-05-26 17:23:58 -06:00
committed by GitHub
parent 22a98bd27a
commit 3f0995d3b4
3 changed files with 26 additions and 6 deletions

View File

@ -226,8 +226,9 @@ impl JsonRpcRequestProcessor {
fn get_fee_calculator_for_blockhash(
&self,
blockhash: &Hash,
commitment: Option<CommitmentConfig>,
) -> RpcResponse<Option<RpcFeeCalculator>> {
let bank = &*self.bank(None)?;
let bank = &*self.bank(commitment)?;
let fee_calculator = bank.get_fee_calculator(blockhash);
new_response(
bank,
@ -821,6 +822,7 @@ pub trait RpcSol {
&self,
meta: Self::Metadata,
blockhash: String,
commitment: Option<CommitmentConfig>,
) -> RpcResponse<Option<RpcFeeCalculator>>;
#[rpc(meta, name = "getFeeRateGovernor")]
@ -1162,6 +1164,7 @@ impl RpcSol for RpcSolImpl {
&self,
meta: Self::Metadata,
blockhash: String,
commitment: Option<CommitmentConfig>,
) -> RpcResponse<Option<RpcFeeCalculator>> {
debug!("get_fee_calculator_for_blockhash rpc request received");
let blockhash =
@ -1169,7 +1172,7 @@ impl RpcSol for RpcSolImpl {
meta.request_processor
.read()
.unwrap()
.get_fee_calculator_for_blockhash(&blockhash)
.get_fee_calculator_for_blockhash(&blockhash, commitment)
}
fn get_fee_rate_governor(&self, meta: Self::Metadata) -> RpcResponse<RpcFeeRateGovernor> {