Tests that if transactions start being capped, transactions are also removed from 'all'
(t *testing.T)
| 1056 | |
| 1057 | // Tests that if transactions start being capped, transactions are also removed from 'all' |
| 1058 | func TestTransactionCapClearsFromAll(t *testing.T) { |
| 1059 | t.Parallel() |
| 1060 | |
| 1061 | // Create the pool to test the limit enforcement with |
| 1062 | statedb, _ := state.New(common.Hash{}, state.NewDatabase(database.NewMemDatabase())) |
| 1063 | blockchain := &testBlockChain{statedb, 1000000, new(event.Feed)} |
| 1064 | |
| 1065 | config := testTxPoolConfig |
| 1066 | config.AccountSlots = 2 |
| 1067 | config.AccountQueue = 2 |
| 1068 | config.GlobalSlots = 8 |
| 1069 | |
| 1070 | pool := NewTxPool(config, configs.TestChainConfig, blockchain) |
| 1071 | defer pool.Stop() |
| 1072 | |
| 1073 | // Create a number of test accounts and fund them |
| 1074 | key, _ := crypto.GenerateKey() |
| 1075 | addr := crypto.PubkeyToAddress(key.PublicKey) |
| 1076 | pool.currentState.AddBalance(addr, big.NewInt(1000000)) |
| 1077 | |
| 1078 | txs := types.Transactions{} |
| 1079 | for j := 0; j < int(config.GlobalSlots)*2; j++ { |
| 1080 | txs = append(txs, transaction(uint64(j), 100000, key)) |
| 1081 | } |
| 1082 | // Import the batch and verify that limits have been enforced |
| 1083 | pool.AddRemotes(txs) |
| 1084 | if err := validateTxPoolInternals(pool); err != nil { |
| 1085 | t.Fatalf("pool internal state corrupted: %v", err) |
| 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | // Tests that if the transaction count belonging to multiple accounts go above |
| 1090 | // some hard threshold, if they are under the minimum guaranteed slot count then |
nothing calls this directly
no test coverage detected