Skip to content

Commit 47d76c5

Browse files
authored
core/txpool: don't inject lazy resolved transactions into the container (ethereum#28917)
* core/txpool: don't inject lazy resolved transactions into the container * core/txpool: minor typo fixes
1 parent 62affdc commit 47d76c5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

core/txpool/subpool.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,17 @@ type LazyTransaction struct {
4444

4545
// Resolve retrieves the full transaction belonging to a lazy handle if it is still
4646
// maintained by the transaction pool.
47+
//
48+
// Note, the method will *not* cache the retrieved transaction if the original
49+
// pool has not cached it. The idea being, that if the tx was too big to insert
50+
// originally, silently saving it will cause more trouble down the line (and
51+
// indeed seems to have caused a memory bloat in the original implementation
52+
// which did just that).
4753
func (ltx *LazyTransaction) Resolve() *types.Transaction {
48-
if ltx.Tx == nil {
49-
ltx.Tx = ltx.Pool.Get(ltx.Hash)
54+
if ltx.Tx != nil {
55+
return ltx.Tx
5056
}
51-
return ltx.Tx
57+
return ltx.Pool.Get(ltx.Hash)
5258
}
5359

5460
// LazyResolver is a minimal interface needed for a transaction pool to satisfy

0 commit comments

Comments
 (0)