Skip to content

Commit 95273af

Browse files
authored
core/rawdb: return iterator error in findTxInBlockBody (#33188)
The iterator loop in findTxInBlockBody returned the outer-scoped err when iter.Err() was non-nil, which could incorrectly propagate a nil or stale error and hide actual RLP decoding issues. This patch returns iter.Err() as intended by the rlp list iterator API, matching established patterns elsewhere in the codebase and improving diagnostics when encountering malformed transaction entries.
1 parent aa36bcd commit 95273af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/rawdb/accessors_indexes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func findTxInBlockBody(blockbody rlp.RawValue, target common.Hash) (*types.Trans
148148
txIndex := uint64(0)
149149
for iter.Next() {
150150
if iter.Err() != nil {
151-
return nil, 0, err
151+
return nil, 0, iter.Err()
152152
}
153153
// The preimage for the hash calculation of legacy transactions
154154
// is just their RLP encoding. For typed (EIP-2718) transactions,

0 commit comments

Comments
 (0)