@@ -2659,7 +2659,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
2659
2659
t .Run ("insufficient funds" , func (t * testing.T ) {
2660
2660
b := testchain .NewBlock (t , chain , 1 , 0 , newTxWithParams (t , chain , opcode .PUSH1 , 10 , 899999999999 , 1 , false ))
2661
2661
body := doRPCCall (fmt .Sprintf (rpc , encodeBinaryToString (t , b )), httpSrv .URL , t )
2662
- checkErrGetResult (t , body , true , neorpc .ErrInsufficientFundsCode )
2662
+ checkErrGetResult (t , body , true , neorpc .ErrVerificationFailedCode )
2663
2663
})
2664
2664
t .Run ("positive" , func (t * testing.T ) {
2665
2665
b := testchain .NewBlock (t , chain , 1 , 0 , newTxWithParams (t , chain , opcode .PUSH1 , 10 , 0 , 1 , false ))
@@ -3341,6 +3341,23 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
3341
3341
body2 := doRPCCall (fmt .Sprintf (rpc , rawTx2 ), httpSrv .URL , t )
3342
3342
checkErrGetResult (t , body2 , true , neorpc .ErrMempoolCapReachedCode )
3343
3343
})
3344
+ t .Run ("mempool conflict" , func (t * testing.T ) {
3345
+ chain , _ , httpSrv := initClearServerWithCustomConfig (t , func (c * config.Config ) {
3346
+ c .ProtocolConfiguration .MemPoolSize = 2
3347
+ })
3348
+
3349
+ // Create and push the first transaction with large network fee.
3350
+ tx := newTxWithParams (t , chain , opcode .PUSH1 , 10 , 1 , 25 , false )
3351
+ rawTx := encodeBinaryToString (t , tx )
3352
+ body := doRPCCall (fmt .Sprintf (rpc , rawTx ), httpSrv .URL , t )
3353
+ checkErrGetResult (t , body , false , 0 )
3354
+
3355
+ // Create and push the second transaction, sender doesn't have enough balance to pay for two transactions.
3356
+ tx2 := newTxWithParams (t , chain , opcode .PUSH1 , 10 , 1 , 25 , false )
3357
+ rawTx2 := encodeBinaryToString (t , tx2 )
3358
+ body2 := doRPCCall (fmt .Sprintf (rpc , rawTx2 ), httpSrv .URL , t )
3359
+ checkErrGetResult (t , body2 , true , neorpc .ErrInsufficientFundsCode )
3360
+ })
3344
3361
})
3345
3362
t .Run ("test functions with unsupported states" , func (t * testing.T ) {
3346
3363
chain , _ , httpSrv := initClearServerWithCustomConfig (t , func (c * config.Config ) {
@@ -3380,7 +3397,7 @@ func newTxWithParams(t *testing.T, chain *core.Blockchain, code opcode.Opcode, v
3380
3397
3381
3398
height := chain .BlockHeight ()
3382
3399
tx := transaction .New ([]byte {byte (code )}, 0 )
3383
- tx .Nonce = height + 1
3400
+ tx .Nonce = uint32 ( random . Int ( 0 , math . MaxUint32 ))
3384
3401
tx .ValidUntilBlock = height + validUntilIncr
3385
3402
tx .Signers = []transaction.Signer {{Account : acc0 .PrivateKey ().GetScriptHash ()}}
3386
3403
tx .SystemFee = systemFee
0 commit comments