lnrpc/invoicesrpc: only try to add hop hints if we have channels
This commit is contained in:
parent
f6d6d6609f
commit
174faa7955
@ -255,14 +255,16 @@ 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")
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll restrict the number of individual route hints
|
if len(openChannels) > 0 {
|
||||||
// to 20 to avoid creating overly large invoices.
|
// We'll restrict the number of individual route hints
|
||||||
const numMaxHophints = 20
|
// to 20 to avoid creating overly large invoices.
|
||||||
hopHints := selectHopHints(
|
const numMaxHophints = 20
|
||||||
amtMSat, cfg, openChannels, numMaxHophints,
|
hopHints := selectHopHints(
|
||||||
)
|
amtMSat, cfg, openChannels, numMaxHophints,
|
||||||
|
)
|
||||||
|
|
||||||
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user