buildPacket

fun buildPacket(paymentHash: ByteVector32, hops: List<Hop>, finalPayload: PaymentOnion.FinalPayload, payloadLength: Int): Triple<MilliSatoshi, CltvExpiry, PacketAndSecrets>

Build an encrypted onion packet with the given final payload.

Return

a (firstAmount, firstExpiry, onion) tuple where:

  • firstAmount is the amount for the first htlc in the route

  • firstExpiry is the cltv expiry for the first htlc in the route

  • the onion to include in the HTLC

Parameters

hops

the hops as computed by the router + extra routes from payment request, including ourselves in the first hop

finalPayload

payload data for the final node (amount, expiry, etc)