Skip to content

Commit

Permalink
Reinstate commitment param to support old clients (#9324)
Browse files Browse the repository at this point in the history
automerge
  • Loading branch information
CriesofCarrots authored Apr 6, 2020
1 parent 543b601 commit cc07c86
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ pub struct JsonRpcConfig {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSignatureStatusConfig {
pub search_transaction_history: bool,
pub search_transaction_history: Option<bool>,
// DEPRECATED
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
}

#[derive(Clone)]
Expand Down Expand Up @@ -440,10 +443,16 @@ impl JsonRpcRequestProcessor {
) -> RpcResponse<Vec<Option<TransactionStatus>>> {
let mut statuses: Vec<Option<TransactionStatus>> = vec![];

// DEPRECATED
let commitment = config
.clone()
.and_then(|x| x.commitment)
.or_else(|| Some(CommitmentConfig::recent()));

let search_transaction_history = config
.map(|x| x.search_transaction_history)
.and_then(|x| x.search_transaction_history)
.unwrap_or(false);
let bank = self.bank(Some(CommitmentConfig::recent()));
let bank = self.bank(commitment);

for signature in signatures {
let status = if let Some(status) = self.get_transaction_status(signature, &bank) {
Expand Down

0 comments on commit cc07c86

Please sign in to comment.