mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-17 06:04:20 +01:00
Merge pull request #5697 from arshbot/export-selectHopHints
invoicesrpc: expose selectHopHints
This commit is contained in:
@@ -152,6 +152,10 @@ you.
|
|||||||
into projects that are compiled to WASM binaries. [That problem was fixed by
|
into projects that are compiled to WASM binaries. [That problem was fixed by
|
||||||
guarding those syscalls with build tags](https://github.com/lightningnetwork/lnd/pull/5526).
|
guarding those syscalls with build tags](https://github.com/lightningnetwork/lnd/pull/5526).
|
||||||
|
|
||||||
|
* The only way to retrieve hophints for a given node was to create an invoice
|
||||||
|
with the `addInvoice` rpc interface. However, now the function has been
|
||||||
|
[exposed in the go package `invoicesrpc`](https://github.com/lightningnetwork/lnd/pull/5697).
|
||||||
|
|
||||||
## Code Health
|
## Code Health
|
||||||
|
|
||||||
### Code cleanup, refactor, typo fixes
|
### Code cleanup, refactor, typo fixes
|
||||||
@@ -265,6 +269,7 @@ change](https://github.com/lightningnetwork/lnd/pull/5613).
|
|||||||
* de6df1re
|
* de6df1re
|
||||||
* ErikEk
|
* ErikEk
|
||||||
* Eugene Siegel
|
* Eugene Siegel
|
||||||
|
* Harsha Goli
|
||||||
* Martin Habovstiak
|
* Martin Habovstiak
|
||||||
* Oliver Gugger
|
* Oliver Gugger
|
||||||
* Wilmer Paulino
|
* Wilmer Paulino
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
|
|||||||
// 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.
|
||||||
numMaxHophints := 20 - len(forcedHints)
|
numMaxHophints := 20 - len(forcedHints)
|
||||||
hopHints := selectHopHints(
|
hopHints := SelectHopHints(
|
||||||
amtMSat, cfg, filteredChannels, numMaxHophints,
|
amtMSat, cfg, filteredChannels, numMaxHophints,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -553,12 +553,12 @@ func addHopHint(hopHints *[]func(*zpay32.Invoice),
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// selectHopHints will select up to numMaxHophints from the set of passed open
|
// SelectHopHints will select up to numMaxHophints from the set of passed open
|
||||||
// channels. The set of hop hints will be returned as a slice of functional
|
// channels. The set of hop hints will be returned as a slice of functional
|
||||||
// options that'll append the route hint to the set of all route hints.
|
// options that'll append the route hint to the set of all route hints.
|
||||||
//
|
//
|
||||||
// TODO(roasbeef): do proper sub-set sum max hints usually << numChans
|
// TODO(roasbeef): do proper sub-set sum max hints usually << numChans
|
||||||
func selectHopHints(amtMSat lnwire.MilliSatoshi, cfg *AddInvoiceConfig,
|
func SelectHopHints(amtMSat lnwire.MilliSatoshi, cfg *AddInvoiceConfig,
|
||||||
openChannels []*channeldb.OpenChannel,
|
openChannels []*channeldb.OpenChannel,
|
||||||
numMaxHophints int) []func(*zpay32.Invoice) {
|
numMaxHophints int) []func(*zpay32.Invoice) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user