rpcserver: use the first hop pubkey as the dest to the htlcSwitch

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.
This commit is contained in:
Olaoluwa Osuntokun 2016-09-21 19:21:23 -07:00
parent 9d5b0885d4
commit 17249316d6
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -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,