mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
common,core,miner: fix goleaks,duplicate init and inconsistent mutex (un)locks
This commit is contained in:
parent
c42f81f81b
commit
0f32302313
3 changed files with 40 additions and 4 deletions
|
|
@ -13,11 +13,15 @@ func IgnoreList() []goleak.Option {
|
||||||
goleak.IgnoreTopFunction("github.com/rjeczalik/notify._Cfunc_CFRunLoopRun"),
|
goleak.IgnoreTopFunction("github.com/rjeczalik/notify._Cfunc_CFRunLoopRun"),
|
||||||
|
|
||||||
// todo: this leaks should be fixed
|
// todo: this leaks should be fixed
|
||||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick"),
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.nullSubscription.func1"),
|
||||||
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribeNewTxsEvent.func1"),
|
||||||
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.(*filterBackend).SubscribePendingLogsEvent.func1"),
|
||||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop"),
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop"),
|
||||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core.(*BlockChain).updateFutureBlocks"),
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core.(*BlockChain).updateFutureBlocks"),
|
||||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core/state/snapshot.(*diskLayer).generate"),
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/core/state/snapshot.(*diskLayer).generate"),
|
||||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/accounts/abi/bind/backends.nullSubscription.func1"),
|
|
||||||
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/eth/filters.(*EventSystem).eventLoop"),
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/eth/filters.(*EventSystem).eventLoop"),
|
||||||
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/event.NewSubscription.func1"),
|
||||||
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/event.NewSubscription"),
|
||||||
|
goleak.IgnoreTopFunction("github.com/ethereum/go-ethereum/metrics.(*meterArbiter).tick"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -614,8 +614,6 @@ func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common
|
||||||
queued[addr] = list.Flatten()
|
queued[addr] = list.Flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
pool.mu.RUnlock()
|
|
||||||
|
|
||||||
return pending, queued
|
return pending, queued
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,40 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/tests/bor/mocks"
|
"github.com/ethereum/go-ethereum/tests/bor/mocks"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO(raneet10): Duplicate initialization from miner/test_backend.go . Recheck whether we need both
|
||||||
|
// func init() {
|
||||||
|
// testTxPoolConfig = txpool.DefaultConfig
|
||||||
|
// testTxPoolConfig.Journal = ""
|
||||||
|
// ethashChainConfig = new(params.ChainConfig)
|
||||||
|
// *ethashChainConfig = *params.TestChainConfig
|
||||||
|
// cliqueChainConfig = new(params.ChainConfig)
|
||||||
|
// *cliqueChainConfig = *params.TestChainConfig
|
||||||
|
// cliqueChainConfig.Clique = ¶ms.CliqueConfig{
|
||||||
|
// Period: 10,
|
||||||
|
// Epoch: 30000,
|
||||||
|
// }
|
||||||
|
|
||||||
|
// signer := types.LatestSigner(params.TestChainConfig)
|
||||||
|
// tx1 := types.MustSignNewTx(testBankKey, signer, &types.AccessListTx{
|
||||||
|
// ChainID: params.TestChainConfig.ChainID,
|
||||||
|
// Nonce: 0,
|
||||||
|
// To: &testUserAddress,
|
||||||
|
// Value: big.NewInt(1000),
|
||||||
|
// Gas: params.TxGas,
|
||||||
|
// GasPrice: big.NewInt(params.InitialBaseFee),
|
||||||
|
// })
|
||||||
|
// pendingTxs = append(pendingTxs, tx1)
|
||||||
|
|
||||||
|
// tx2 := types.MustSignNewTx(testBankKey, signer, &types.LegacyTx{
|
||||||
|
// Nonce: 1,
|
||||||
|
// To: &testUserAddress,
|
||||||
|
// Value: big.NewInt(1000),
|
||||||
|
// Gas: params.TxGas,
|
||||||
|
// GasPrice: big.NewInt(params.InitialBaseFee),
|
||||||
|
// })
|
||||||
|
// newTxs = append(newTxs, tx2)
|
||||||
|
// }
|
||||||
|
|
||||||
// newTestWorker creates a new test worker with the given parameters.
|
// newTestWorker creates a new test worker with the given parameters.
|
||||||
// nolint:unparam
|
// nolint:unparam
|
||||||
func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int, noempty bool, delay uint, opcodeDelay uint) (*worker, *testWorkerBackend, func()) {
|
func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int, noempty bool, delay uint, opcodeDelay uint) (*worker, *testWorkerBackend, func()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue