From 913ec695b7124a702a429cac8fc5a5838552b9bb Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Mon, 6 Apr 2020 10:38:08 -0600 Subject: [PATCH] Reinstate commitment param to support old clients --- core/src/rpc.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/src/rpc.rs b/core/src/rpc.rs index 7dc8888e228610..0b7b01ecff6210 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -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, + // DEPRECATED + #[serde(flatten)] + pub commitment: Option, } #[derive(Clone)] @@ -440,10 +443,16 @@ impl JsonRpcRequestProcessor { ) -> RpcResponse>> { let mut statuses: Vec> = 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) {