@@ -514,6 +514,53 @@ func Test_MultipleTransactionSubmissionsWithinNonRecentInterval(t *testing.T) {
514514 )
515515}
516516
517+ func Test_MultipleTransactionSubmissionsWithDuplicates (t * testing.T ) {
518+ _ , cfg , stop := setupGatewayNode (t )
519+ defer stop ()
520+
521+ rpcTester := & rpcTest {
522+ url : fmt .Sprintf ("%s:%d" , cfg .RPCHost , cfg .RPCPort ),
523+ }
524+
525+ eoaKey , err := crypto .HexToECDSA (eoaTestPrivateKey )
526+ require .NoError (t , err )
527+
528+ testAddr := common .HexToAddress ("55253ed90B70b96C73092D8680915aaF50081194" )
529+ nonce := uint64 (0 )
530+ hashes := make ([]common.Hash , 0 )
531+
532+ signed , _ , err := evmSign (big .NewInt (10 ), 21000 , eoaKey , nonce , & testAddr , nil )
533+ require .NoError (t , err )
534+ nonce += 1
535+
536+ txHash , err := rpcTester .sendRawTx (signed )
537+ require .NoError (t , err )
538+ hashes = append (hashes , txHash )
539+
540+ for range 5 {
541+ // All these transactions are duplicates, since we don't change any
542+ // of the payload data. These will end up having the same tx hash
543+ // as well.
544+ signed , _ , err := evmSign (big .NewInt (10 ), 15_000_000 , eoaKey , nonce , & testAddr , nil )
545+ require .NoError (t , err )
546+
547+ txHash , err := rpcTester .sendRawTx (signed )
548+ require .NoError (t , err )
549+ hashes = append (hashes , txHash )
550+ }
551+
552+ assert .Eventually (t , func () bool {
553+ for _ , h := range hashes {
554+ rcp , err := rpcTester .getReceipt (h .String ())
555+ if err != nil || rcp == nil || rcp .Status != 1 {
556+ return false
557+ }
558+ }
559+
560+ return true
561+ }, time .Second * 15 , time .Second * 1 , "all transactions were not executed" )
562+ }
563+
517564func setupGatewayNode (t * testing.T ) (emulator.Emulator , config.Config , func ()) {
518565 srv , err := startEmulator (true )
519566 require .NoError (t , err )
0 commit comments