Bigtable bug fixes (#12058) (#12060)

* Accommodate stricted get_bincode_cell in get_confirmed_signatures_for_address

* Sort signatures newest-oldest, even within slot

(cherry picked from commit 879c98efeb)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
This commit is contained in:
mergify[bot]
2020-09-05 03:31:35 +00:00
committed by GitHub
parent ae8acada8c
commit feed960ef3

View File

@ -397,12 +397,14 @@ impl LedgerStorage {
let mut infos = vec![]; let mut infos = vec![];
let starting_slot_tx_by_addr_infos = bigtable let starting_slot_tx_len = bigtable
.get_bincode_cell::<Vec<TransactionByAddrInfo>>( .get_bincode_cell::<Vec<TransactionByAddrInfo>>(
"tx-by-addr", "tx-by-addr",
format!("{}{}", address_prefix, slot_to_key(!first_slot)), format!("{}{}", address_prefix, slot_to_key(!first_slot)),
) )
.await?; .await
.map(|txs| txs.len())
.unwrap_or(0);
// Return the next tx-by-addr data of amount `limit` plus extra to account for the largest // Return the next tx-by-addr data of amount `limit` plus extra to account for the largest
// number that might be flitered out // number that might be flitered out
@ -411,7 +413,7 @@ impl LedgerStorage {
"tx-by-addr", "tx-by-addr",
Some(format!("{}{}", address_prefix, slot_to_key(!first_slot))), Some(format!("{}{}", address_prefix, slot_to_key(!first_slot))),
Some(format!("{}{}", address_prefix, slot_to_key(!last_slot))), Some(format!("{}{}", address_prefix, slot_to_key(!last_slot))),
limit as i64 + starting_slot_tx_by_addr_infos.len() as i64, limit as i64 + starting_slot_tx_len as i64,
) )
.await?; .await?;
@ -422,8 +424,9 @@ impl LedgerStorage {
row_key row_key
)) ))
})?; })?;
let cell_data: Vec<TransactionByAddrInfo> = let mut cell_data: Vec<TransactionByAddrInfo> =
bigtable::deserialize_cell_data(&data, "tx-by-addr", row_key)?; bigtable::deserialize_cell_data(&data, "tx-by-addr", row_key)?;
cell_data.reverse();
for tx_by_addr_info in cell_data.into_iter() { for tx_by_addr_info in cell_data.into_iter() {
// Filter out records before `before_transaction_index` // Filter out records before `before_transaction_index`
if slot == first_slot && tx_by_addr_info.index >= before_transaction_index { if slot == first_slot && tx_by_addr_info.index >= before_transaction_index {