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

This commit is contained in:
Daniel Liu 2026-03-11 09:56:37 +08:00 committed by GitHub
parent 9eb90bca0e
commit de142957b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,11 +43,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