Update tx_tracker_test.go

This commit is contained in:
alex017 2026-01-09 18:17:32 +01:00 committed by GitHub
parent 127d1f42bb
commit 1781196ad4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,25 +93,6 @@ func (env *testEnv) close() {
env.chain.Stop() env.chain.Stop()
} }
// nolint:unused
func (env *testEnv) setGasTip(gasTip uint64) {
env.pool.SetGasTip(new(big.Int).SetUint64(gasTip))
}
// nolint:unused
func (env *testEnv) makeTx(nonce uint64, gasPrice *big.Int) *types.Transaction {
if nonce == 0 {
head := env.chain.CurrentHeader()
state, _ := env.chain.StateAt(head.Root)
nonce = state.GetNonce(address)
}
if gasPrice == nil {
gasPrice = big.NewInt(params.GWei)
}
tx, _ := types.SignTx(types.NewTransaction(nonce, common.Address{0x00}, big.NewInt(1000), params.TxGas, gasPrice, nil), signer, key)
return tx
}
func (env *testEnv) makeTxs(n int) []*types.Transaction { func (env *testEnv) makeTxs(n int) []*types.Transaction {
head := env.chain.CurrentHeader() head := env.chain.CurrentHeader()
state, _ := env.chain.StateAt(head.Root) state, _ := env.chain.StateAt(head.Root)
@ -125,23 +106,6 @@ func (env *testEnv) makeTxs(n int) []*types.Transaction {
return txs return txs
} }
// nolint:unused
func (env *testEnv) commit() {
head := env.chain.CurrentBlock()
block := env.chain.GetBlock(head.Hash(), head.Number.Uint64())
blocks, _ := core.GenerateChain(env.chain.Config(), block, ethash.NewFaker(), env.genDb, 1, func(i int, gen *core.BlockGen) {
tx, err := types.SignTx(types.NewTransaction(gen.TxNonce(address), common.Address{0x00}, big.NewInt(1000), params.TxGas, gen.BaseFee(), nil), signer, key)
if err != nil {
panic(err)
}
gen.AddTx(tx)
})
env.chain.InsertChain(blocks)
if err := env.pool.Sync(); err != nil {
panic(err)
}
}
func TestResubmit(t *testing.T) { func TestResubmit(t *testing.T) {
env := newTestEnv(t, 10, 0, "") env := newTestEnv(t, 10, 0, "")
defer env.close() defer env.close()