Skip to content

Commit

Permalink
Make Blockstore populate TransactionStatusIndex for backwards compat
Browse files Browse the repository at this point in the history
Versions v1.16 and v1.17 expect these entries to be populated; there is
code that calls .unwrap() on the Option returned by .get(). A change
that is currently in master (and should land in v1.18) will make it such
that these entries are no longer read.

Until the TransactionStatusIndexMeta's are no longer read, they should
continue to be populated to allow for software downgrade scenarios. So,
add back code that #33649 overzealously removed to populate these
entries.
  • Loading branch information
Steven Czabaniuk committed Oct 18, 2023
1 parent e96678b commit 2c09538
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,17 @@ impl Blockstore {
if !self.is_primary_access() {
return Ok(());
}

// Initialize TransactionStatusIndexMeta if they are not present already
if self.transaction_status_index_cf.get(0)?.is_none() {
self.transaction_status_index_cf
.put(0, &TransactionStatusIndexMeta::default())?;
}
if self.transaction_status_index_cf.get(1)?.is_none() {
self.transaction_status_index_cf
.put(1, &TransactionStatusIndexMeta::default())?;
}

// If present, delete dummy entries inserted by old software
// https://github.com/solana-labs/solana/blob/bc2b372/ledger/src/blockstore.rs#L2130-L2137
let transaction_status_dummy_key = cf::TransactionStatus::as_index(2);
Expand Down

0 comments on commit 2c09538

Please sign in to comment.