@@ -82,22 +82,22 @@ func generateFastUpgradeConsensus() (fastUpgradeProtocols config.ConsensusProtoc
8282 fastParams .MaxUpgradeWaitRounds = 0
8383 fastParams .MaxVersionStringLen += len (consensusTestFastUpgrade ("" ))
8484 fastParams .ApprovedUpgrades = make (map [protocol.ConsensusVersion ]uint64 )
85+ // set the small lambda to 500 for the duration of dependent tests.
86+ fastParams .AgreementFilterTimeout = 500 * time .Millisecond
87+ fastParams .AgreementFilterTimeoutPeriod0 = 500 * time .Millisecond
8588
8689 for ver := range params .ApprovedUpgrades {
8790 fastParams .ApprovedUpgrades [consensusTestFastUpgrade (ver )] = 0
8891 }
8992
9093 fastUpgradeProtocols [consensusTestFastUpgrade (proto )] = fastParams
9194
92- // set the small lambda to 500 for the duration of dependent tests.
93- fastParams .AgreementFilterTimeout = time .Second
94- fastParams .AgreementFilterTimeoutPeriod0 = time .Second
9595 }
9696 return
9797}
9898
9999func testAccountsCanSendMoneyAcrossUpgrade (t * testing.T , templatePath string ) {
100- t .Parallel ()
100+ // t.Parallel()
101101 a := require .New (fixtures .SynchronizedTest (t ))
102102
103103 consensus := generateFastUpgradeConsensus ()
@@ -141,23 +141,41 @@ func testAccountsCanSendMoneyAcrossUpgrade(t *testing.T, templatePath string) {
141141 var pingTxids []string
142142 var pongTxids []string
143143
144+ pongWalletHandle , err := pongClient .GetUnencryptedWalletHandle ()
145+ a .NoError (err )
146+ pingWalletHandle , err := pingClient .GetUnencryptedWalletHandle ()
147+ a .NoError (err )
144148 startTime := time .Now ()
149+ var lastTxnSendRound uint64
145150 for curStatus .LastVersion == initialStatus .LastVersion {
146- pongTx , err := pongClient .SendPaymentFromUnencryptedWallet (pongAccount , pingAccount , transactionFee , amountPongSendsPing , GenerateRandomBytes (8 ))
147- a .NoError (err , "fixture should be able to send money (pong -> ping)" )
148- pongTxids = append (pongTxids , pongTx .ID ().String ())
151+ iterationStartTime := time .Now ()
152+ if lastTxnSendRound != curStatus .LastRound {
153+ pongTx , err := pongClient .SendPaymentFromWallet (pongWalletHandle , nil , pongAccount , pingAccount , transactionFee , amountPongSendsPing , GenerateRandomBytes (8 ), "" , 0 , 0 )
154+ a .NoError (err , "fixture should be able to send money (pong -> ping)" )
155+ pongTxids = append (pongTxids , pongTx .ID ().String ())
149156
150- pingTx , err := pingClient .SendPaymentFromUnencryptedWallet ( pingAccount , pongAccount , transactionFee , amountPingSendsPong , GenerateRandomBytes (8 ))
151- a .NoError (err , "fixture should be able to send money (ping -> pong)" )
152- pingTxids = append (pingTxids , pingTx .ID ().String ())
157+ pingTx , err := pingClient .SendPaymentFromWallet ( pingWalletHandle , nil , pingAccount , pongAccount , transactionFee , amountPingSendsPong , GenerateRandomBytes (8 ), "" , 0 , 0 )
158+ a .NoError (err , "fixture should be able to send money (ping -> pong)" )
159+ pingTxids = append (pingTxids , pingTx .ID ().String ())
153160
154- expectedPingBalance = expectedPingBalance - transactionFee - amountPingSendsPong + amountPongSendsPing
155- expectedPongBalance = expectedPongBalance - transactionFee - amountPongSendsPing + amountPingSendsPong
161+ expectedPingBalance = expectedPingBalance - transactionFee - amountPingSendsPong + amountPongSendsPing
162+ expectedPongBalance = expectedPongBalance - transactionFee - amountPongSendsPing + amountPingSendsPong
163+
164+ lastTxnSendRound = curStatus .LastRound
165+ }
156166
157167 curStatus , err = pongClient .Status ()
158168 a .NoError (err )
159169
160- time .Sleep (time .Second )
170+ pongWalletHandle , err = pongClient .GetUnencryptedWalletHandle ()
171+ a .NoError (err )
172+ pingWalletHandle , err = pingClient .GetUnencryptedWalletHandle ()
173+ a .NoError (err )
174+
175+ iterationDuration := time .Now ().Sub (iterationStartTime )
176+ if iterationDuration < 500 * time .Millisecond {
177+ time .Sleep (500 * time .Millisecond - iterationDuration )
178+ }
161179
162180 if time .Now ().After (startTime .Add (3 * time .Minute )) {
163181 a .Fail ("upgrade taking too long" )
@@ -175,18 +193,32 @@ func testAccountsCanSendMoneyAcrossUpgrade(t *testing.T, templatePath string) {
175193 if curStatus .LastRound > initialStatus .LastRound + 2 {
176194 break
177195 }
178- pongTx , err := pongClient .SendPaymentFromUnencryptedWallet (pongAccount , pingAccount , transactionFee , amountPongSendsPing , GenerateRandomBytes (8 ))
179- a .NoError (err , "fixture should be able to send money (pong -> ping)" )
180- pongTxids = append (pongTxids , pongTx .ID ().String ())
181196
182- pingTx , err := pingClient .SendPaymentFromUnencryptedWallet (pingAccount , pongAccount , transactionFee , amountPingSendsPong , GenerateRandomBytes (8 ))
183- a .NoError (err , "fixture should be able to send money (ping -> pong)" )
184- pingTxids = append (pingTxids , pingTx .ID ().String ())
197+ iterationStartTime := time .Now ()
198+ if lastTxnSendRound != curStatus .LastRound {
199+ pongTx , err := pongClient .SendPaymentFromWallet (pongWalletHandle , nil , pongAccount , pingAccount , transactionFee , amountPongSendsPing , GenerateRandomBytes (8 ), "" , 0 , 0 )
200+ a .NoError (err , "fixture should be able to send money (pong -> ping)" )
201+ pongTxids = append (pongTxids , pongTx .ID ().String ())
202+
203+ pingTx , err := pingClient .SendPaymentFromWallet (pingWalletHandle , nil , pingAccount , pongAccount , transactionFee , amountPingSendsPong , GenerateRandomBytes (8 ), "" , 0 , 0 )
204+ a .NoError (err , "fixture should be able to send money (ping -> pong)" )
205+ pingTxids = append (pingTxids , pingTx .ID ().String ())
206+
207+ expectedPingBalance = expectedPingBalance - transactionFee - amountPingSendsPong + amountPongSendsPing
208+ expectedPongBalance = expectedPongBalance - transactionFee - amountPongSendsPing + amountPingSendsPong
209+
210+ lastTxnSendRound = curStatus .LastRound
211+ }
185212
186- expectedPingBalance = expectedPingBalance - transactionFee - amountPingSendsPong + amountPongSendsPing
187- expectedPongBalance = expectedPongBalance - transactionFee - amountPongSendsPing + amountPingSendsPong
213+ pongWalletHandle , err = pongClient .GetUnencryptedWalletHandle ()
214+ a .NoError (err )
215+ pingWalletHandle , err = pingClient .GetUnencryptedWalletHandle ()
216+ a .NoError (err )
188217
189- time .Sleep (time .Second )
218+ iterationDuration := time .Now ().Sub (iterationStartTime )
219+ if iterationDuration < 500 * time .Millisecond {
220+ time .Sleep (500 * time .Millisecond - iterationDuration )
221+ }
190222 }
191223
192224 curStatus , err = pongClient .Status ()
0 commit comments