Skip to content

Commit 7d4f183

Browse files
committed
fix(node): include synthetic txs in current_block so eth_getTransactionByHash doesn't panic
1 parent 0514bac commit 7d4f183

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hydradx"
3-
version = "15.1.3"
3+
version = "15.1.4"
44
description = "Hydration node"
55
authors = ["GalacticCouncil"]
66
edition = "2021"

node/src/synthetic_logs_override.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616
//! produced before this runtime shipped (bounded only by whether their events
1717
//! still decode).
1818
//!
19-
//! - `current_transaction_statuses` / `current_receipts`: real entries first,
20-
//! then synth (whose `transaction_index` continues from the real count).
21-
//! - `current_block`: real tx list untouched; only OR the synth-log blooms into
19+
//! All three views stay index-aligned (real entries first, synth appended in a
20+
//! stable order, `transaction_index` continuing from the real count) so a synth
21+
//! tx's mapping-DB index resolves consistently across them:
22+
//! - `current_transaction_statuses` / `current_receipts`: real, then synth.
23+
//! - `current_block`: synth txs appended to `transactions` (so
24+
//! `eth_getTransactionByHash`/`*_receipt` can index them — fc-rpc does
25+
//! `block.transactions[index]`), and the synth-log blooms OR'd into
2226
//! `header.logs_bloom` so `filter_range_logs`' header-bloom prefilter doesn't
2327
//! skip synth-only blocks.
2428
@@ -108,10 +112,11 @@ where
108112

109113
fn current_block(&self, at: Hash) -> Option<EthBlock> {
110114
let mut block = self.inner.current_block(at)?;
111-
for (_, status, _) in self.synthetic(at) {
115+
for (tx, status, _) in self.synthetic(at) {
112116
for (h, s) in block.header.logs_bloom.0.iter_mut().zip(status.logs_bloom.0.iter()) {
113117
*h |= *s;
114118
}
119+
block.transactions.push(tx);
115120
}
116121
Some(block)
117122
}

0 commit comments

Comments
 (0)