File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -721,7 +721,8 @@ func abciResponses(n int, code uint32) []*abci.ResponseDeliverTx {
721
721
}
722
722
723
723
func TestTxPool_ConcurrentlyAddingTx (t * testing.T ) {
724
- txmp := setup (t , 500 )
724
+ cacheSize := 500
725
+ txPool := setup (t , cacheSize )
725
726
tx := types .Tx ("sender=0000=1" )
726
727
727
728
numTxs := 10
@@ -731,7 +732,7 @@ func TestTxPool_ConcurrentlyAddingTx(t *testing.T) {
731
732
wg .Add (1 )
732
733
go func (sender uint16 ) {
733
734
defer wg .Done ()
734
- _ , err := txmp .TryAddNewTx (tx , tx .Key (), mempool.TxInfo {SenderID : sender })
735
+ _ , err := txPool .TryAddNewTx (tx , tx .Key (), mempool.TxInfo {SenderID : sender })
735
736
errCh <- err
736
737
}(uint16 (i + 1 ))
737
738
}
@@ -747,7 +748,10 @@ func TestTxPool_ConcurrentlyAddingTx(t *testing.T) {
747
748
errCount ++
748
749
}
749
750
}
750
- require .Equal (t , numTxs - 1 , errCount )
751
+ // At least one tx should succeed and get added to the mempool without an error.
752
+ require .Less (t , errCount , numTxs )
753
+ // The rest of the txs may fail with ErrTxInMempool but the number of errors isn't exact.
754
+ require .LessOrEqual (t , errCount , numTxs - 1 )
751
755
}
752
756
753
757
func TestTxPool_BroadcastQueue (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments