MCPcopy Create free account
hub / github.com/CPChain/chain / TestTransactionMissingNonce

Function TestTransactionMissingNonce

core/tx_pool_test.go:411–432  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

409}
410
411func TestTransactionMissingNonce(t *testing.T) {
412 t.Parallel()
413
414 pool, key := setupTxPool()
415 defer pool.Stop()
416
417 addr := crypto.PubkeyToAddress(key.PublicKey)
418 pool.currentState.AddBalance(addr, big.NewInt(100000000000000))
419 tx := transaction(1, 100000, key)
420 if _, err := pool.add(tx, false); err != nil {
421 t.Error("didn't expect error", err)
422 }
423 if len(pool.pending) != 0 {
424 t.Error("expected 0 pending transactions, got", len(pool.pending))
425 }
426 if pool.queue[addr].Len() != 1 {
427 t.Error("expected 1 queued transaction, got", pool.queue[addr].Len())
428 }
429 if pool.all.Count() != 1 {
430 t.Error("expected 1 total transactions, got", pool.all.Count())
431 }
432}
433
434func TestTransactionNonceRecovery(t *testing.T) {
435 t.Parallel()

Callers

nothing calls this directly

Calls 8

setupTxPoolFunction · 0.85
transactionFunction · 0.85
StopMethod · 0.65
AddBalanceMethod · 0.65
ErrorMethod · 0.65
LenMethod · 0.65
addMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected