Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Aug 2, 2024
1 parent 9fbdfe4 commit 2906fc2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lnclient/lnd/lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,6 @@ func (svc *LNDService) MakeInvoice(ctx context.Context, amount int64, descriptio
expiry = lnclient.DEFAULT_INVOICE_EXPIRY
}

addInvoiceRequest := &lnrpc.Invoice{
ValueMsat: amount,
Memo: description,
DescriptionHash: descriptionHashBytes,
Expiry: expiry,
}

channels, err := svc.ListChannels(ctx)
if err != nil {
return nil, err
Expand All @@ -260,9 +253,12 @@ func (svc *LNDService) MakeInvoice(ctx context.Context, amount int64, descriptio
}
}

// if there is not even one public channel, use private channel hints in the invoice
if !hasPublicChannels {
addInvoiceRequest.Private = true
addInvoiceRequest := &lnrpc.Invoice{
ValueMsat: amount,
Memo: description,
DescriptionHash: descriptionHashBytes,
Expiry: expiry,
Private: !hasPublicChannels, // use private channel hints in the invoice
}

resp, err := svc.client.AddInvoice(ctx, addInvoiceRequest)
Expand Down

0 comments on commit 2906fc2

Please sign in to comment.