core/txpool: don't inject lazy resolved transactions into the container (#28917)

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

* core/txpool: minor typo fixes
This commit is contained in:
Péter Szilágyi 2024-02-02 20:39:12 +02:00 committed by GitHub
parent 62affdc9c5
commit 47d76c5f95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.Pool.Get(ltx.Hash)
}
// LazyResolver is a minimal interface needed for a transaction pool to satisfy