mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 07:42:39 +02:00
Merge pull request #1888 from joostjager/routestruct
lnrpc+routing: fix unmarshallRoute and simplify route structure
This commit is contained in:
@@ -1274,7 +1274,7 @@ func pruneChannelFromRoutes(routes []*Route, skipChan uint64) []*Route {
|
||||
// fee information attached. The set of routes returned may be less than the
|
||||
// initial set of paths as it's possible we drop a route if it can't handle the
|
||||
// total payment flow after fees are calculated.
|
||||
func pathsToFeeSortedRoutes(source Vertex, paths [][]*ChannelHop,
|
||||
func pathsToFeeSortedRoutes(source Vertex, paths [][]*channeldb.ChannelEdgePolicy,
|
||||
finalCLTVDelta uint16, amt, feeLimit lnwire.MilliSatoshi,
|
||||
currentHeight uint32) ([]*Route, error) {
|
||||
|
||||
@@ -1461,19 +1461,13 @@ func generateSphinxPacket(route *Route, paymentHash []byte) ([]byte,
|
||||
// in each hop.
|
||||
nodes := make([]*btcec.PublicKey, len(route.Hops))
|
||||
for i, hop := range route.Hops {
|
||||
// We create a new instance of the public key to avoid possibly
|
||||
// mutating the curve parameters, which are unset in a higher
|
||||
// level in order to avoid spamming the logs.
|
||||
nodePub, err := hop.Channel.Node.PubKey()
|
||||
pub, err := btcec.ParsePubKey(hop.PubKeyBytes[:],
|
||||
btcec.S256())
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
pub := btcec.PublicKey{
|
||||
Curve: btcec.S256(),
|
||||
X: nodePub.X,
|
||||
Y: nodePub.Y,
|
||||
}
|
||||
nodes[i] = &pub
|
||||
|
||||
nodes[i] = pub
|
||||
}
|
||||
|
||||
// Next we generate the per-hop payload which gives each node within
|
||||
@@ -1736,7 +1730,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
||||
// the payment. If this attempt fails, then we'll continue on
|
||||
// to the next available route.
|
||||
firstHop := lnwire.NewShortChanIDFromInt(
|
||||
route.Hops[0].Channel.ChannelID,
|
||||
route.Hops[0].ChannelID,
|
||||
)
|
||||
preImage, sendError = r.cfg.SendToSwitch(
|
||||
firstHop, htlcAdd, circuit,
|
||||
|
Reference in New Issue
Block a user