Plug getConfirmedSignaturesForAddress2 into bigtable storage
This commit is contained in:
@ -839,8 +839,8 @@ impl JsonRpcRequestProcessor {
|
||||
pub fn get_confirmed_signatures_for_address2(
|
||||
&self,
|
||||
address: Pubkey,
|
||||
before: Option<Signature>,
|
||||
limit: usize,
|
||||
mut before: Option<Signature>,
|
||||
mut limit: usize,
|
||||
) -> Result<Vec<RpcConfirmedTransactionStatusWithSignature>> {
|
||||
if self.config.enable_rpc_transaction_history {
|
||||
let highest_confirmed_root = self
|
||||
@ -849,7 +849,7 @@ impl JsonRpcRequestProcessor {
|
||||
.unwrap()
|
||||
.highest_confirmed_root();
|
||||
|
||||
let results = self
|
||||
let mut results = self
|
||||
.blockstore
|
||||
.get_confirmed_signatures_for_address2(
|
||||
address,
|
||||
@ -859,6 +859,27 @@ impl JsonRpcRequestProcessor {
|
||||
)
|
||||
.map_err(|err| Error::invalid_params(format!("{}", err)))?;
|
||||
|
||||
if results.len() < limit {
|
||||
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
|
||||
if !results.is_empty() {
|
||||
limit -= results.len();
|
||||
before = results.last().map(|x| x.signature);
|
||||
}
|
||||
|
||||
let mut bigtable_results = self
|
||||
.runtime_handle
|
||||
.block_on(
|
||||
bigtable_ledger_storage.get_confirmed_signatures_for_address(
|
||||
&address,
|
||||
before.as_ref(),
|
||||
limit,
|
||||
),
|
||||
)
|
||||
.map_err(|err| Error::invalid_params(format!("{}", err)))?;
|
||||
results.append(&mut bigtable_results)
|
||||
}
|
||||
}
|
||||
|
||||
Ok(results.into_iter().map(|x| x.into()).collect())
|
||||
} else {
|
||||
Ok(vec![])
|
||||
|
Reference in New Issue
Block a user