eth/protocols/eth: polish test

This commit is contained in:
Gary Rong 2025-03-19 09:18:36 +08:00
parent a763bf1b8b
commit 65f31760a7

View file

@ -72,10 +72,7 @@ func newTestBackend(blocks int) *testBackend {
// newTestBackendWithGenerator creates a chain with a number of explicitly defined blocks and // newTestBackendWithGenerator creates a chain with a number of explicitly defined blocks and
// wraps it into a mock backend. // wraps it into a mock backend.
func newTestBackendWithGenerator( func newTestBackendWithGenerator(blocks int, shanghai bool, cancun bool, generator func(int, *core.BlockGen)) *testBackend {
blocks int, shanghai bool, cancun bool,
generator func(int, *core.BlockGen),
) *testBackend {
var ( var (
// Create a database pre-initialize with a genesis block // Create a database pre-initialize with a genesis block
db = rawdb.NewMemoryDatabase() db = rawdb.NewMemoryDatabase()
@ -621,12 +618,11 @@ func testGetPooledTransaction(t *testing.T, blobTx bool) {
peer, _ := newTestPeer("peer", ETH68, backend) peer, _ := newTestPeer("peer", ETH68, backend)
defer peer.close() defer peer.close()
signer := types.NewCancunSigner(params.TestChainConfig.ChainID)
var ( var (
tx *types.Transaction tx *types.Transaction
err error err error
signer = types.NewCancunSigner(params.TestChainConfig.ChainID)
) )
if blobTx { if blobTx {
tx, err = types.SignNewTx(testKey, signer, &types.BlobTx{ tx, err = types.SignNewTx(testKey, signer, &types.BlobTx{
ChainID: uint256.MustFromBig(params.TestChainConfig.ChainID), ChainID: uint256.MustFromBig(params.TestChainConfig.ChainID),