Merge pull request #970 from bhandras/listswaps-assetclient-panic

loopd: avoid panic if asset client is not set
This commit is contained in:
András Bánki-Horváth 2025-06-24 18:09:32 +02:00 committed by GitHub
commit 2538055d7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -418,11 +418,20 @@ func (s *swapClientServer) marshallSwap(ctx context.Context,
outGoingChanSet = loopSwap.OutgoingChanSet
if loopSwap.AssetSwapInfo != nil {
assetName, err := s.assetClient.GetAssetName(
ctx, loopSwap.AssetSwapInfo.AssetId,
var (
// Default the asset name to "N/A" in case we
// can't fetch it due to the asset client not
// being set.
assetName string = "N/A"
err error
)
if err != nil {
return nil, err
if s.assetClient != nil {
assetName, err = s.assetClient.GetAssetName(
ctx, loopSwap.AssetSwapInfo.AssetId,
)
if err != nil {
return nil, err
}
}
assetInfo = &looprpc.AssetLoopOutInfo{