mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
lnrpc/invoicesrpc: only try to add hop hints if we have channels
This commit is contained in:
parent
f6d6d6609f
commit
174faa7955
1 changed files with 9 additions and 7 deletions
|
@ -255,6 +255,7 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
|
||||||
return nil, nil, fmt.Errorf("could not fetch all channels")
|
return nil, nil, fmt.Errorf("could not fetch all channels")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(openChannels) > 0 {
|
||||||
// We'll restrict the number of individual route hints
|
// We'll restrict the number of individual route hints
|
||||||
// to 20 to avoid creating overly large invoices.
|
// to 20 to avoid creating overly large invoices.
|
||||||
const numMaxHophints = 20
|
const numMaxHophints = 20
|
||||||
|
@ -264,6 +265,7 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
|
||||||
|
|
||||||
options = append(options, hopHints...)
|
options = append(options, hopHints...)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set our desired invoice features and add them to our list of options.
|
// Set our desired invoice features and add them to our list of options.
|
||||||
invoiceFeatures := cfg.GenInvoiceFeatures()
|
invoiceFeatures := cfg.GenInvoiceFeatures()
|
||||||
|
|
Loading…
Add table
Reference in a new issue