automerge
This commit is contained in:
@ -397,6 +397,24 @@ impl JsonRpcRequestProcessor {
|
|||||||
.unwrap_or(None))
|
.unwrap_or(None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_signature_confirmation_status(
|
||||||
|
&self,
|
||||||
|
signature: Signature,
|
||||||
|
commitment: Option<CommitmentConfig>,
|
||||||
|
) -> Option<RpcSignatureConfirmation> {
|
||||||
|
self.get_transaction_status(signature, &self.bank(commitment))
|
||||||
|
.map(
|
||||||
|
|TransactionStatus {
|
||||||
|
status,
|
||||||
|
confirmations,
|
||||||
|
..
|
||||||
|
}| RpcSignatureConfirmation {
|
||||||
|
confirmations: confirmations.unwrap_or(MAX_LOCKOUT_HISTORY + 1),
|
||||||
|
status,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_signature_status(
|
pub fn get_signature_status(
|
||||||
&self,
|
&self,
|
||||||
signature: Signature,
|
signature: Signature,
|
||||||
@ -417,24 +435,7 @@ impl JsonRpcRequestProcessor {
|
|||||||
let bank = self.bank(commitment);
|
let bank = self.bank(commitment);
|
||||||
|
|
||||||
for signature in signatures {
|
for signature in signatures {
|
||||||
let status = bank
|
let status = self.get_transaction_status(signature, &bank);
|
||||||
.get_signature_status_slot(&signature)
|
|
||||||
.map(|(slot, status)| {
|
|
||||||
let r_block_commitment_cache = self.block_commitment_cache.read().unwrap();
|
|
||||||
|
|
||||||
let confirmations = if r_block_commitment_cache.root() >= slot {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
r_block_commitment_cache
|
|
||||||
.get_confirmation_count(slot)
|
|
||||||
.or(Some(0))
|
|
||||||
};
|
|
||||||
TransactionStatus {
|
|
||||||
slot,
|
|
||||||
status,
|
|
||||||
confirmations,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
statuses.push(status);
|
statuses.push(status);
|
||||||
}
|
}
|
||||||
Ok(Response {
|
Ok(Response {
|
||||||
@ -442,6 +443,30 @@ impl JsonRpcRequestProcessor {
|
|||||||
value: statuses,
|
value: statuses,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_transaction_status(
|
||||||
|
&self,
|
||||||
|
signature: Signature,
|
||||||
|
bank: &Arc<Bank>,
|
||||||
|
) -> Option<TransactionStatus> {
|
||||||
|
bank.get_signature_status_slot(&signature)
|
||||||
|
.map(|(slot, status)| {
|
||||||
|
let r_block_commitment_cache = self.block_commitment_cache.read().unwrap();
|
||||||
|
|
||||||
|
let confirmations = if r_block_commitment_cache.root() >= slot {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
r_block_commitment_cache
|
||||||
|
.get_confirmation_count(slot)
|
||||||
|
.or(Some(0))
|
||||||
|
};
|
||||||
|
TransactionStatus {
|
||||||
|
slot,
|
||||||
|
status,
|
||||||
|
confirmations,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_tpu_addr(cluster_info: &Arc<RwLock<ClusterInfo>>) -> Result<SocketAddr> {
|
fn get_tpu_addr(cluster_info: &Arc<RwLock<ClusterInfo>>) -> Result<SocketAddr> {
|
||||||
@ -564,6 +589,14 @@ pub trait RpcSol {
|
|||||||
#[rpc(meta, name = "getFeeRateGovernor")]
|
#[rpc(meta, name = "getFeeRateGovernor")]
|
||||||
fn get_fee_rate_governor(&self, meta: Self::Metadata) -> RpcResponse<RpcFeeRateGovernor>;
|
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")]
|
#[rpc(meta, name = "getSignatureStatus")]
|
||||||
fn get_signature_status(
|
fn get_signature_status(
|
||||||
&self,
|
&self,
|
||||||
@ -903,6 +936,24 @@ impl RpcSol for RpcSolImpl {
|
|||||||
.get_fee_rate_governor()
|
.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(
|
fn get_signature_status(
|
||||||
&self,
|
&self,
|
||||||
meta: Self::Metadata,
|
meta: Self::Metadata,
|
||||||
|
Reference in New Issue
Block a user