@@ -79,10 +79,23 @@ func testKeyGeneration(t *testing.T, suite *E2ETestSuite) {
7979 if suite .mpcClient == nil {
8080 t .Fatal ("MPC client is not initialized. Make sure Setup subtest runs first." )
8181 }
82+
83+ walletID := uuid .New ().String ()
84+
85+ // Create a new wallet
86+ createWalletAndVerify (t , suite , walletID )
87+
88+ // Create another new wallet with the same wallet ID
89+ createWalletAndVerify (t , suite , walletID )
90+
91+ t .Log ("Key generation test completed" )
92+ }
93+
94+ func createWalletAndVerify (t * testing.T , suite * E2ETestSuite , walletID string ) {
8295 // Generate 1 wallet ID for testing
8396 walletIDs := make ([]string , 0 , 10 )
8497 for i := 0 ; i < 1 ; i ++ {
85- walletIDs = append (walletIDs , uuid . New (). String () )
98+ walletIDs = append (walletIDs , walletID )
8699 suite .walletIDs = append (suite .walletIDs , walletIDs [i ])
87100 }
88101
@@ -92,7 +105,11 @@ func testKeyGeneration(t *testing.T, suite *E2ETestSuite) {
92105 err := suite .mpcClient .OnWalletCreationResult (func (result event.KeygenResultEvent ) {
93106 logger .Info ("On wallet creation result" , "event" , result )
94107 t .Logf ("Received keygen result for wallet %s: %s" , result .WalletID , result .ResultType )
95- suite .keygenResults [result .WalletID ] = & result
108+
109+ // For testing replay properly, don't overwrite existing result for the same wallet ID to preserve the first result
110+ if _ , exists := suite .keygenResults [result .WalletID ]; ! exists {
111+ suite .keygenResults [result .WalletID ] = & result
112+ }
96113
97114 if result .ResultType == event .ResultTypeError {
98115 t .Logf ("Keygen failed for wallet %s: %s (%s)" , result .WalletID , result .ErrorReason , result .ErrorCode )
@@ -165,8 +182,6 @@ checkResults:
165182 assert .NotEmpty (t , result .EDDSAPubKey , "EdDSA public key should not be empty for wallet %s" , walletID )
166183 }
167184 }
168-
169- t .Log ("Key generation test completed" )
170185}
171186
172187func verifyKeyConsistency (t * testing.T , suite * E2ETestSuite ) {
0 commit comments