@@ -207,20 +207,20 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
207207 erinAssetBalance := assetSendAmount - erinFundingAmount
208208
209209 // Assert that we see the funding outputs in the wallet.
210- itest . AssertBalances (
210+ assertBalance (
211211 t .t , charlieTap , charlieFundingAmount ,
212212 itest .WithAssetID (assetID ),
213213 itest .WithScriptKeyType (asset .ScriptKeyScriptPathChannel ),
214214 itest .WithNumUtxos (1 ),
215215 itest .WithScriptKey (fundingScriptKeyBytes ),
216216 )
217- itest . AssertBalances (
217+ assertBalance (
218218 t .t , daveTap , daveFundingAmount , itest .WithAssetID (assetID ),
219219 itest .WithScriptKeyType (asset .ScriptKeyScriptPathChannel ),
220220 itest .WithNumUtxos (1 ),
221221 itest .WithScriptKey (fundingScriptKeyBytes ),
222222 )
223- itest . AssertBalances (
223+ assertBalance (
224224 t .t , erinTap , erinFundingAmount , itest .WithAssetID (assetID ),
225225 itest .WithScriptKeyType (asset .ScriptKeyScriptPathChannel ),
226226 itest .WithNumUtxos (1 ),
@@ -229,14 +229,13 @@ func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap,
229229
230230 // After opening the channels, the asset balance of the funding nodes
231231 // should have been decreased with the funding amount.
232- itest .AssertBalances (
233- t .t , charlieTap , charlieAssetBalance ,
234- itest .WithAssetID (assetID ),
232+ assertBalance (
233+ t .t , charlieTap , charlieAssetBalance , itest .WithAssetID (assetID ),
235234 )
236- itest . AssertBalances (
235+ assertBalance (
237236 t .t , daveTap , daveAssetBalance , itest .WithAssetID (assetID ),
238237 )
239- itest . AssertBalances (
238+ assertBalance (
240239 t .t , erinTap , erinAssetBalance , itest .WithAssetID (assetID ),
241240 )
242241
@@ -527,6 +526,18 @@ func createTestAssetNetworkGroupKey(ctx context.Context, t *harnessTest,
527526 return chanPointCD , chanPointEF
528527}
529528
529+ // assertBalance is a thin wrapper around itest.AssertBalances that skips the
530+ // balance check for old versions during the backward compatibility test.
531+ func assertBalance (t * testing.T , client * tapClient , balance uint64 ,
532+ opts ... itest.BalanceOption ) {
533+
534+ if client .node .Cfg .SkipBalanceChecks {
535+ return
536+ }
537+
538+ itest .AssertBalances (t , client , balance , opts ... )
539+ }
540+
530541// sendAssetsAndAssert sends the given amount of assets to the recipient and
531542// asserts that the transfer was successful. It also checks that the asset
532543// balance of the sender and recipient is as expected.
@@ -718,6 +729,12 @@ func assertPendingChannels(t *testing.T, node *HarnessNode,
718729 require .NoError (t , err )
719730 require .Len (t , pendingChannelsResp .PendingOpenChannels , numChannels )
720731
732+ // For older versions (during the backward compatibility test), if the
733+ // channel custom data is in the old format, we can't do further checks.
734+ if node .Cfg .OldChannelFormat {
735+ return
736+ }
737+
721738 pendingChan := pendingChannelsResp .PendingOpenChannels [0 ]
722739 var pendingJSON rfqmsg.JsonAssetChannel
723740 err = json .Unmarshal (
@@ -768,6 +785,12 @@ func haveFundingAsset(assetChannel *rfqmsg.JsonAssetChannel,
768785func assertAssetChan (t * testing.T , src , dst * HarnessNode , fundingAmount uint64 ,
769786 channelAssets []* taprpc.Asset ) {
770787
788+ if src .Cfg .OldChannelFormat {
789+ t .Logf ("Skipping asset channel check for %s->%s, old format" ,
790+ src .Cfg .Name , dst .Cfg .Name )
791+ return
792+ }
793+
771794 err := wait .NoError (func () error {
772795 a , err := getChannelCustomData (src , dst )
773796 if err != nil {
@@ -1822,8 +1845,12 @@ func closeAssetChannelAndAssert(t *harnessTest, net *NetworkHarness,
18221845 )
18231846 require .NoError (t .t , err )
18241847
1825- assertWaitingCloseChannelAssetData (t .t , local , chanPoint )
1826- assertWaitingCloseChannelAssetData (t .t , remote , chanPoint )
1848+ if ! local .Cfg .OldChannelFormat {
1849+ assertWaitingCloseChannelAssetData (t .t , local , chanPoint )
1850+ }
1851+ if ! remote .Cfg .OldChannelFormat {
1852+ assertWaitingCloseChannelAssetData (t .t , remote , chanPoint )
1853+ }
18271854
18281855 mineBlocks (t , net , 1 , 1 )
18291856
@@ -1846,8 +1873,12 @@ func closeAssetChannelAndAssert(t *harnessTest, net *NetworkHarness,
18461873 universeTap ,
18471874 )
18481875
1849- assertClosedChannelAssetData (t .t , local , chanPoint )
1850- assertClosedChannelAssetData (t .t , remote , chanPoint )
1876+ if ! local .Cfg .OldChannelFormat {
1877+ assertClosedChannelAssetData (t .t , local , chanPoint )
1878+ }
1879+ if ! remote .Cfg .OldChannelFormat {
1880+ assertClosedChannelAssetData (t .t , remote , chanPoint )
1881+ }
18511882}
18521883
18531884// assertDefaultCoOpCloseBalance returns a default implementation of the co-op
0 commit comments