mirror of https://github.com/BTCPrivate/lnd.git
routing: use converted hop payloads for sphinx packet when creating onion
This commit is contained in:
parent
4d8bb21d9d
commit
fca51d6165
|
@ -848,8 +848,6 @@ func (r *ChannelRouter) FindRoutes(target *btcec.PublicKey, amt btcutil.Amount)
|
||||||
// the onion route specified by the passed layer 3 route. The blob returned
|
// the onion route specified by the passed layer 3 route. The blob returned
|
||||||
// from this function can immediately be included within an HTLC add packet to
|
// from this function can immediately be included within an HTLC add packet to
|
||||||
// be sent to the first hop within the route.
|
// be sent to the first hop within the route.
|
||||||
//
|
|
||||||
// TODO(roasbeef): add params for the per-hop payloads
|
|
||||||
func generateSphinxPacket(route *Route, paymentHash []byte) ([]byte, error) {
|
func generateSphinxPacket(route *Route, paymentHash []byte) ([]byte, error) {
|
||||||
// First obtain all the public keys along the route which are contained
|
// First obtain all the public keys along the route which are contained
|
||||||
// in each hop.
|
// in each hop.
|
||||||
|
@ -869,14 +867,10 @@ func generateSphinxPacket(route *Route, paymentHash []byte) ([]byte, error) {
|
||||||
// Next we generate the per-hop payload which gives each node within
|
// Next we generate the per-hop payload which gives each node within
|
||||||
// the route the necessary information (fees, CLTV value, etc) to
|
// the route the necessary information (fees, CLTV value, etc) to
|
||||||
// properly forward the payment.
|
// properly forward the payment.
|
||||||
// TODO(roasbeef): properly set CLTV value, payment amount, and chain
|
hopPayloads := route.ToHopPayloads()
|
||||||
// within hop payloads.
|
|
||||||
var hopPayloads [][]byte
|
log.Tracef("Constructed per-hop payloads for payment_hash=%x: %v",
|
||||||
for i := 0; i < len(route.Hops); i++ {
|
paymentHash[:], spew.Sdump(hopPayloads))
|
||||||
payload := bytes.Repeat([]byte{byte('A' + i)},
|
|
||||||
sphinx.HopPayloadSize)
|
|
||||||
hopPayloads = append(hopPayloads, payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
sessionKey, err := btcec.NewPrivateKey(btcec.S256())
|
sessionKey, err := btcec.NewPrivateKey(btcec.S256())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -902,7 +896,7 @@ func generateSphinxPacket(route *Route, paymentHash []byte) ([]byte, error) {
|
||||||
newLogClosure(func() string {
|
newLogClosure(func() string {
|
||||||
// We unset the internal curve here in order to keep
|
// We unset the internal curve here in order to keep
|
||||||
// the logs from getting noisy.
|
// the logs from getting noisy.
|
||||||
sphinxPacket.Header.EphemeralKey.Curve = nil
|
sphinxPacket.EphemeralKey.Curve = nil
|
||||||
return spew.Sdump(sphinxPacket)
|
return spew.Sdump(sphinxPacket)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue