Skip to content

Commit a63aa36

Browse files
ZZiigguurraattZZiigguurraatt
authored andcommitted
printChannels: if no assetID defined, don't try to print asset balances and if assetID not found, give a log message.
1 parent ac14dc0 commit a63aa36

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

itest/assets_test.go

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,33 +2115,43 @@ func printChannels(t *testing.T, node *HarnessNode, peer *HarnessNode,
21152115
&custom_channel_data)
21162116
require.NoError(t, err)
21172117

2118-
asset := getAssetFromAssetList(custom_channel_data.Assets, assetID)
2119-
2120-
var assetsBalanceStatus string
2121-
2122-
// check to see if the channel should have the ability to actually
2123-
// send the asset payment
2124-
if assetsToSend == 0 {
2125-
assetsBalanceStatus = ""
2126-
} else if asset.LocalBalance >= assetsToSend {
2127-
assetsBalanceStatus = "(✔) "
2128-
} else {
2129-
assetsBalanceStatus = "(x) "
2118+
if len(assetID) > 0 {
2119+
2120+
asset := getAssetFromAssetList(custom_channel_data.Assets,
2121+
assetID)
2122+
2123+
if (asset != rfqmsg.JsonAssetChanInfo{}) {
2124+
2125+
var assetsBalanceStatus string
2126+
2127+
// check to see if the channel should have the ability
2128+
// to actually send the asset payment
2129+
if assetsToSend == 0 {
2130+
assetsBalanceStatus = ""
2131+
} else if asset.LocalBalance >= assetsToSend {
2132+
assetsBalanceStatus = "(✔) "
2133+
} else {
2134+
assetsBalanceStatus = "(x) "
2135+
}
2136+
2137+
// note: taproot assets channels don't currently have
2138+
// a concept of reserve like normal sats channels, so
2139+
// this printout is simpler than the sats channel
2140+
// printed above
2141+
t.Logf(assetsBalanceStatus+"("+state+") cap: %v " +
2142+
asset.AssetInfo.AssetGenesis.Name +
2143+
", "+node.Cfg.Name+"->[bal: %v " +
2144+
asset.AssetInfo.AssetGenesis.Name+"], " +
2145+
peer.Cfg.Name+"->[bal: %v " +
2146+
asset.AssetInfo.AssetGenesis.Name+"]",
2147+
asset.Capacity,
2148+
asset.LocalBalance,
2149+
asset.RemoteBalance,
2150+
)
2151+
} else {
2152+
t.Logf("assetID %v not found", assetID)
2153+
}
21302154
}
2131-
2132-
// note: taproot assets channels don't currently have a concept of
2133-
// reserve like normal sats channels, so this printout is simpler
2134-
// than the sats channel printed above
2135-
t.Logf(assetsBalanceStatus+"("+state+") cap: %v " +
2136-
asset.AssetInfo.AssetGenesis.Name +
2137-
", "+node.Cfg.Name+"->[bal: %v " +
2138-
asset.AssetInfo.AssetGenesis.Name+"], " +
2139-
peer.Cfg.Name+"->[bal: %v " +
2140-
asset.AssetInfo.AssetGenesis.Name+"]",
2141-
asset.Capacity,
2142-
asset.LocalBalance,
2143-
asset.RemoteBalance,
2144-
)
21452155
}
21462156
}
21472157
}

0 commit comments

Comments
 (0)