Skip to content

Commit

Permalink
Undo breaking rpc removal of getSignatureConfirmation (#9247)
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots authored Apr 2, 2020
1 parent a3f6b04 commit d4bb7ce
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,25 @@ impl JsonRpcRequestProcessor {
.unwrap_or(None))
}

pub fn get_signature_confirmation_status(
&self,
signature: Signature,
commitment: Option<CommitmentConfig>,
) -> Option<RpcSignatureConfirmation> {
self.bank(commitment)
.get_signature_confirmation_status(&signature)
.map(
|SignatureConfirmationStatus {
confirmations,
status,
..
}| RpcSignatureConfirmation {
confirmations,
status,
},
)
}

pub fn get_signature_status(
&self,
signature: Signature,
Expand Down Expand Up @@ -560,6 +579,14 @@ pub trait RpcSol {
#[rpc(meta, name = "getFeeRateGovernor")]
fn get_fee_rate_governor(&self, meta: Self::Metadata) -> RpcResponse<RpcFeeRateGovernor>;

#[rpc(meta, name = "getSignatureConfirmation")]
fn get_signature_confirmation(
&self,
meta: Self::Metadata,
signature_str: String,
commitment: Option<CommitmentConfig>,
) -> Result<Option<RpcSignatureConfirmation>>;

#[rpc(meta, name = "getSignatureStatus")]
fn get_signature_status(
&self,
Expand Down Expand Up @@ -899,6 +926,24 @@ impl RpcSol for RpcSolImpl {
.get_fee_rate_governor()
}

fn get_signature_confirmation(
&self,
meta: Self::Metadata,
signature_str: String,
commitment: Option<CommitmentConfig>,
) -> Result<Option<RpcSignatureConfirmation>> {
debug!(
"get_signature_confirmation rpc request received: {:?}",
signature_str
);
let signature = verify_signature(&signature_str)?;
Ok(meta
.request_processor
.read()
.unwrap()
.get_signature_confirmation_status(signature, commitment))
}

fn get_signature_status(
&self,
meta: Self::Metadata,
Expand Down

0 comments on commit d4bb7ce

Please sign in to comment.