Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions crates/storage/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,17 @@ impl Store {
let tx_hash_bytes = transaction_hash.as_bytes();
let tx = db.begin_read()?;

// Use prefix iterator to find all entries with this transaction hash
// rust-rocksdb's prefix_iterator_cf seeks but does not bound iteration —
// caller must stop on the first prefix mismatch.
let mut iter = tx.prefix_iterator(TRANSACTION_LOCATIONS, tx_hash_bytes)?;
let mut transaction_locations = Vec::new();

while let Some(Ok((key, value))) = iter.next() {
// Ensure key is exactly tx_hash + block_hash (32 + 32 = 64 bytes)
// and starts with our exact tx_hash
// Key is tx_hash (32) + block_hash (32) = 64 bytes.
if key.len() == 64 && &key[0..32] == tx_hash_bytes {
transaction_locations.push(<(BlockNumber, BlockHash, Index)>::decode(&value)?);
} else {
break;
}
}

Expand Down
Loading