From 81fd1b3cf9c4c4c9f0e06f8bdcbaa8b29c81b052 Mon Sep 17 00:00:00 2001 From: ucwong Date: Tue, 12 Dec 2023 15:23:36 +0000 Subject: [PATCH] core/txpool : small cleanup refactors (#28654) --- cmd/geth/logging_test.go | 2 +- core/txpool/legacypool/legacypool.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/geth/logging_test.go b/cmd/geth/logging_test.go index 50991554b..b5ce03f4b 100644 --- a/cmd/geth/logging_test.go +++ b/cmd/geth/logging_test.go @@ -21,6 +21,7 @@ package main import ( "bufio" "bytes" + "encoding/json" "fmt" "io" "math/rand" @@ -28,7 +29,6 @@ import ( "os/exec" "strings" "testing" - "encoding/json" "github.com/ethereum/go-ethereum/internal/reexec" ) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 8450d89a2..f7d4a2e1e 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -923,8 +923,7 @@ func (pool *LegacyPool) addLocals(txs []*types.Transaction) []error { // addLocal enqueues a single local transaction into the pool if it is valid. This is // a convenience wrapper around addLocals. func (pool *LegacyPool) addLocal(tx *types.Transaction) error { - errs := pool.addLocals([]*types.Transaction{tx}) - return errs[0] + return pool.addLocals([]*types.Transaction{tx})[0] } // addRemotes enqueues a batch of transactions into the pool if they are valid. If the @@ -939,8 +938,7 @@ func (pool *LegacyPool) addRemotes(txs []*types.Transaction) []error { // addRemote enqueues a single transaction into the pool if it is valid. This is a convenience // wrapper around addRemotes. func (pool *LegacyPool) addRemote(tx *types.Transaction) error { - errs := pool.addRemotes([]*types.Transaction{tx}) - return errs[0] + return pool.addRemotes([]*types.Transaction{tx})[0] } // addRemotesSync is like addRemotes, but waits for pool reorganization. Tests use this method.