(t *testing.T)
| 225 | } |
| 226 | |
| 227 | func TestInvalidTransactions(t *testing.T) { |
| 228 | t.Parallel() |
| 229 | |
| 230 | pool, key := setupTxPool() |
| 231 | defer pool.Stop() |
| 232 | |
| 233 | tx := transaction(0, 100, key) |
| 234 | from, _ := deriveSender(tx) |
| 235 | |
| 236 | pool.currentState.AddBalance(from, big.NewInt(1)) |
| 237 | if err := pool.AddRemote(tx); err != ErrInsufficientFunds { |
| 238 | t.Error("expected", ErrInsufficientFunds) |
| 239 | } |
| 240 | |
| 241 | balance := new(big.Int).Add(tx.Value(), new(big.Int).Mul(new(big.Int).SetUint64(tx.Gas()), tx.GasPrice())) |
| 242 | pool.currentState.AddBalance(from, balance) |
| 243 | if err := pool.AddRemote(tx); err != ErrIntrinsicGas { |
| 244 | t.Error("expected", ErrIntrinsicGas, "got", err) |
| 245 | } |
| 246 | |
| 247 | pool.currentState.SetNonce(from, 1) |
| 248 | pool.currentState.AddBalance(from, big.NewInt(0xffffffffffffff)) |
| 249 | tx = transaction(0, 100000, key) |
| 250 | if err := pool.AddRemote(tx); err != ErrNonceTooLow { |
| 251 | t.Error("expected", ErrNonceTooLow) |
| 252 | } |
| 253 | |
| 254 | tx = transaction(1, 100000, key) |
| 255 | pool.gasPrice = big.NewInt(1000) |
| 256 | if err := pool.AddRemote(tx); err != ErrUnderpriced { |
| 257 | t.Error("expected", ErrUnderpriced, "got", err) |
| 258 | } |
| 259 | if err := pool.AddLocal(tx); err != nil { |
| 260 | t.Error("expected", nil, "got", err) |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func TestTransactionQueue(t *testing.T) { |
| 265 | t.Parallel() |
nothing calls this directly
no test coverage detected