Skip to content

Commit

Permalink
core/txpool: don't inject lazy resolved transactions into the contain…
Browse files Browse the repository at this point in the history
…er (ethereum#28917)

* core/txpool: don't inject lazy resolved transactions into the container

* core/txpool: minor typo fixes
  • Loading branch information
karalabe authored Feb 2, 2024
1 parent 62affdc commit 47d76c5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/txpool/subpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ type LazyTransaction struct {

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

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

0 comments on commit 47d76c5

Please sign in to comment.