diff --git a/Cargo.lock b/Cargo.lock
index 5d5607b7375..5f1de28c9e0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10337,6 +10337,7 @@ dependencies = [
"solana-inflation",
"solana-pubkey 4.0.0",
"solana-reward-info",
+ "solana-signature",
"solana-transaction",
"solana-transaction-error",
"solana-transaction-status-client-types",
diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs
index 0ba1b89c157..a41ee125549 100644
--- a/cli/src/cluster_query.rs
+++ b/cli/src/cluster_query.rs
@@ -2299,6 +2299,7 @@ pub async fn process_transaction_history(
block_time,
slot,
transaction: transaction_with_meta,
+ ..
} = confirmed_transaction;
let decoded_transaction =
diff --git a/cli/src/wallet.rs b/cli/src/wallet.rs
index 0a6918bcef5..d23b8017337 100644
--- a/cli/src/wallet.rs
+++ b/cli/src/wallet.rs
@@ -777,6 +777,7 @@ pub async fn process_confirm(
block_time,
slot,
transaction: transaction_with_meta,
+ ..
} = confirmed_transaction;
let decoded_transaction =
diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs
index d68ca468d61..d71da732db0 100644
--- a/ledger/src/blockstore.rs
+++ b/ledger/src/blockstore.rs
@@ -3166,7 +3166,7 @@ impl Blockstore {
if let Some((slot, meta)) =
self.get_transaction_status(signature, confirmed_unrooted_slots)?
{
- let transaction = self
+ let (transaction, index) = self
.find_transaction_in_slot(slot, signature)?
.ok_or(BlockstoreError::TransactionStatusSlotMismatch)?; // Should not happen
@@ -3177,32 +3177,40 @@ impl Blockstore {
VersionedTransactionWithStatusMeta { transaction, meta },
),
block_time,
+ index,
}))
} else {
Ok(None)
}
}
+ /// Finds a transaction by signature in the given slot and returns it along with its index.
+ ///
+ /// The index represents the transaction's 0-based position in the flattened list of all
+ /// transactions across all entries in this slot. This matches the `transaction_index`
+ /// stored in `AddressSignatures` when `write_transaction_status` is called during block
+ /// processing.
fn find_transaction_in_slot(
&self,
slot: Slot,
signature: Signature,
- ) -> Result