// Tests that transactions can be added to strict lists and list contents and
// nonce boundaries are correctly maintained.
Tests that transactions can be added to strict lists and list contents and
nonce boundaries are correctly maintained.
// Tests that transactions can be added to strict lists and list contents and // nonce boundaries are correctly maintained .
func TestStrictTxListAdd(t *testing.T) {
	key, _ := crypto.GenerateKey()
	txs := make(types.Transactions, 1024)
	for i := 0; i < len(txs); i++ {
		txs[i] = transaction(uint64(i), 0, key)
	}
	list := newTxList(true)
	for _, v := range rand.Perm(len(txs)) {
		list.Add(txs[v], DefaultTxPoolConfig.PriceBump)
	}
	if len(list.txs.items) != len(txs) {
		t.Errorf("transaction count mismatch: have %d, want %d", len(list.txs.items), len(txs))
	}
	for i, tx := range txs {
		if list.txs.items[tx.Nonce()] != tx {
			t.Errorf("item %d: transaction mismatch: have %v, want %v", i, list.txs.items[tx.Nonce()], tx)
		}
	}
}
func TestStrictTxListAdd ( t * testing . T ) { key , _ := crypto . GenerateKey ( ) txs := make ( types . Transactions , 1024 ) for i := 0 ; i < len ( txs ) ; i ++ { txs [ i ] = transaction ( uint64 ( i ) , 0 , key ) } list := newTxList ( true ) for _ , v := range rand . Perm ( len ( txs ) ) { list . Add ( txs [ v ] , DefaultTxPoolConfig . PriceBump ) } if len ( list . txs . items ) != len ( txs ) { t . Errorf ( " " , len ( list . txs . items ) , len ( txs ) ) } for i , tx := range txs { if list . txs . items [ tx . Nonce ( ) ] != tx { t . Errorf ( " " , i , list . txs . items [ tx . Nonce ( ) ] , tx ) } } }
Tests that transactions can be added to strict lists and list contents and
nonce boundaries are correctly maintained.
Tests that transactions can be added to strict lists and list contents and nonce boundaries are correctly maintained .
// Generate a list of transactions to insert // Insert the transactions in a random order // Verify internal state