@@ -208,3 +208,62 @@ func TestAccountsCanSendMoneyAcrossTxSync(t *testing.T) {
208
208
}
209
209
}
210
210
}
211
+
212
+ // this test checks that a relay would relay a transaction
213
+ // received via the txnsync onto a node that doesn't support
214
+ // transaction sync.
215
+ func TestTransactionSyncRelayBridge (t * testing.T ) {
216
+
217
+ partitiontest .PartitionTest (t )
218
+ defer fixtures .ShutdownSynchronizedTest (t )
219
+
220
+ a := require .New (fixtures .SynchronizedTest (t ))
221
+
222
+ var fixture fixtures.RestClientFixture
223
+ fixture .SetupNoStart (t , filepath .Join ("nettemplates" , "ThreeNodesOneOnline.json" ))
224
+ defer fixture .Shutdown ()
225
+
226
+ onlineNodeController , err := fixture .GetNodeController ("OnlineNode" )
227
+ a .NoError (err )
228
+
229
+ cfg , err := config .LoadConfigFromDisk (onlineNodeController .GetDataDir ())
230
+ a .NoError (err )
231
+ cfg .NetworkProtocolVersion = "2.1"
232
+ cfg .SaveToDisk (onlineNodeController .GetDataDir ())
233
+
234
+ offlineNodeController , err := fixture .GetNodeController ("OfflineNode" )
235
+ a .NoError (err )
236
+
237
+ cfg , err = config .LoadConfigFromDisk (offlineNodeController .GetDataDir ())
238
+ a .NoError (err )
239
+ cfg .NetworkProtocolVersion = "3.0"
240
+ cfg .SaveToDisk (offlineNodeController .GetDataDir ())
241
+
242
+ fixture .Start ()
243
+
244
+ client := fixture .GetLibGoalClientFromNodeController (offlineNodeController )
245
+ accounts , err := fixture .GetNodeWalletsSortedByBalance (client .DataDir ())
246
+ a .NoError (err )
247
+
248
+ a .Equal (1 , len (accounts ))
249
+
250
+ sendingAccount := accounts [0 ].Address
251
+
252
+ _ , err = client .SendPaymentFromUnencryptedWallet (sendingAccount , sendingAccount , 1024 * 1024 , 1024 , nil )
253
+ a .NoError (err )
254
+
255
+ startRoundStatus , err := client .Status ()
256
+ a .NoError (err )
257
+ for {
258
+ pendingTxns , err := client .GetPendingTransactions (2 )
259
+ a .NoError (err )
260
+ if pendingTxns .TotalTxns == 0 {
261
+ break
262
+ }
263
+ status , err := client .Status ()
264
+ a .NoError (err )
265
+ _ , err = client .WaitForRound (status .LastRound )
266
+ a .NoError (err )
267
+ a .Less (uint64 (status .LastRound ), uint64 (startRoundStatus .LastRound + 5 ), "transaction is still pending after 5 rounds, whereas it should have been confirmed within 2 rounds." )
268
+ }
269
+ }
0 commit comments