PayToOpenRequest

data class PayToOpenRequest(chainHash: ByteVector32, fundingSatoshis: Satoshi, amountMsat: MilliSatoshi, payToOpenMinAmountMsat: MilliSatoshi, payToOpenFeeSatoshis: Satoshi, paymentHash: ByteVector32, expireAt: Long, finalPacket: OnionRoutingPacket) : LightningMessage, HasChainHash

When we don't have enough incoming liquidity to receive a payment, our peer may open a channel to us on-the-fly to carry that payment. This message contains details that allow us to recalculate the fee that our peer will take in exchange for the new channel. This allows us to combine multiple requests for the same payment and figure out the final fee that will be applied.

Parameters

chainHash

chain we're on.

fundingSatoshis

total capacity of the channel our peer will open to us (some of the funds may be on their side).

amountMsat

payment amount covered by this new channel: we will receive push_msat = amountMsat - fees.

payToOpenMinAmountMsat

minimum amount for a pay-to-open to be attempted, this should be compared to the total amount in the case of an MPP payment.

payToOpenFeeSatoshis

fees that will be deducted from the amount pushed to us (this fee covers the on-chain fees our peer will pay to open the channel).

paymentHash

payment hash.

expireAt

after the proposal expires, our peer will fail the payment and won't open a channel to us.

finalPacket

onion packet that we would have received if there had been a channel to forward the payment to.

Constructors

PayToOpenRequest
Link copied to clipboard
common
fun PayToOpenRequest(chainHash: ByteVector32, fundingSatoshis: Satoshi, amountMsat: MilliSatoshi, payToOpenMinAmountMsat: MilliSatoshi, payToOpenFeeSatoshis: Satoshi, paymentHash: ByteVector32, expireAt: Long, finalPacket: OnionRoutingPacket)

Types

Companion
Link copied to clipboard
common
object Companion : LightningMessageReader<PayToOpenRequest>

Functions

write
Link copied to clipboard
common
open fun write(): ByteArray
open override fun write(out: Output)

Properties

amountMsat
Link copied to clipboard
common
val amountMsat: MilliSatoshi
chainHash
Link copied to clipboard
common
open override val chainHash: ByteVector32
expireAt
Link copied to clipboard
common
val expireAt: Long
finalPacket
Link copied to clipboard
common
val finalPacket: OnionRoutingPacket
fundingSatoshis
Link copied to clipboard
common
val fundingSatoshis: Satoshi
paymentHash
Link copied to clipboard
common
val paymentHash: ByteVector32
payToOpenFeeSatoshis
Link copied to clipboard
common
val payToOpenFeeSatoshis: Satoshi
payToOpenMinAmountMsat
Link copied to clipboard
common
val payToOpenMinAmountMsat: MilliSatoshi
type
Link copied to clipboard
common
open override val type: Long

Once decrypted, lightning messages start with a 2-byte type that uniquely identifies the kind of message received. See https://github.com/lightningnetwork/lightning-rfc/blob/master/01-messaging.md#lightning-message-format.