From 17249316d6b8747e542331e4a6f24a11df17234f Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 21 Sep 2016 19:21:23 -0700 Subject: [PATCH] rpcserver: use the first hop pubkey as the dest to the htlcSwitch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit modifies the sendpayment command slightly to use the pub key of the *first* hop within the route as the destination within the htlcPacket sent to the htlcSwitch. Previously, since only single hop was implemented, the final destination would be set within the htlcPkt, causing the route to fail as the switch doesn’t have a direct link to the dest in the multi-hop case. --- rpcserver.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index c70f91d9..b99cd96c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -510,7 +510,11 @@ func (r *rpcServer) SendPayment(paymentStream lnrpc.Lightning_SendPaymentServer) RedemptionHashes: [][32]byte{rHash}, OnionBlob: sphinxPacket, } - destAddr := wire.ShaHash(fastsha256.Sum256(nextPayment.Dest)) + firstHopPub, err := hex.DecodeString(path[1].String()) + if err != nil { + return err + } + destAddr := wire.ShaHash(fastsha256.Sum256(firstHopPub)) htlcPkt := &htlcPacket{ dest: destAddr, msg: htlcAdd,