Commitments

data class Commitments(channelConfig: ChannelConfig, channelFeatures: ChannelFeatures, localParams: LocalParams, remoteParams: RemoteParams, channelFlags: Byte, localCommit: LocalCommit, remoteCommit: RemoteCommit, localChanges: LocalChanges, remoteChanges: RemoteChanges, localNextHtlcId: Long, remoteNextHtlcId: Long, payments: Map<Long, UUID>, remoteNextCommitInfo: Either<WaitingForRevocation, PublicKey>, commitInput: Transactions.InputInfo, remotePerCommitmentSecrets: ShaChain, channelId: ByteVector32, remoteChannelData: EncryptedChannelData)

about remoteNextCommitInfo: we either:

  • have built and signed their next commit tx with their next revocation hash which can now be discarded

  • have their next per-commitment point So, when we've signed and sent a commit message and are waiting for their revocation message, theirNextCommitInfo is their next commit tx. The rest of the time, it is their next per-commitment point

Constructors

Commitments
Link copied to clipboard
common
fun Commitments(channelConfig: ChannelConfig, channelFeatures: ChannelFeatures, localParams: LocalParams, remoteParams: RemoteParams, channelFlags: Byte, localCommit: LocalCommit, remoteCommit: RemoteCommit, localChanges: LocalChanges, remoteChanges: RemoteChanges, localNextHtlcId: Long, remoteNextHtlcId: Long, payments: Map<Long, UUID>, remoteNextCommitInfo: Either<WaitingForRevocation, PublicKey>, commitInput: Transactions.InputInfo, remotePerCommitmentSecrets: ShaChain, channelId: ByteVector32, remoteChannelData: EncryptedChannelData = EncryptedChannelData.empty)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

almostTimedOutIncomingHtlcs
Link copied to clipboard
common
fun almostTimedOutIncomingHtlcs(blockHeight: Long, fulfillSafety: CltvExpiryDelta): Set<UpdateAddHtlc>

Incoming HTLCs that are close to timing out are potentially dangerous. If we released the pre-image for those HTLCs, we need to get a remote signed updated commitment that removes this HTLC. Otherwise when we get close to the timeout, we risk an on-chain race condition between their HTLC timeout and our HTLC success in case of a force-close.

availableBalanceForReceive
Link copied to clipboard
common
fun availableBalanceForReceive(): MilliSatoshi
availableBalanceForSend
Link copied to clipboard
common
fun availableBalanceForSend(): MilliSatoshi
hasNoPendingHtlcs
Link copied to clipboard
common
fun hasNoPendingHtlcs(): Boolean
hasNoPendingHtlcsOrFeeUpdate
Link copied to clipboard
common
fun hasNoPendingHtlcsOrFeeUpdate(): Boolean
isMoreRecent
Link copied to clipboard
common
fun isMoreRecent(other: Commitments): Boolean
localHasChanges
Link copied to clipboard
common
fun localHasChanges(): Boolean
localHasUnsignedOutgoingHtlcs
Link copied to clipboard
common
fun localHasUnsignedOutgoingHtlcs(): Boolean
localHasUnsignedOutgoingUpdateFee
Link copied to clipboard
common
fun localHasUnsignedOutgoingUpdateFee(): Boolean
nothingAtStake
Link copied to clipboard
common
fun nothingAtStake(): Boolean
receiveAdd
Link copied to clipboard
common
fun receiveAdd(add: UpdateAddHtlc): Either<ChannelException, Commitments>
receiveCommit
Link copied to clipboard
common
fun receiveCommit(commit: CommitSig, keyManager: KeyManager, log: Logger): Either<ChannelException, Pair<Commitments, RevokeAndAck>>
receiveFail
Link copied to clipboard
common
receiveFailMalformed
Link copied to clipboard
receiveFee
Link copied to clipboard
common
fun receiveFee(fee: UpdateFee, feerateTolerance: FeerateTolerance): Either<ChannelException, Commitments>
receiveFulfill
Link copied to clipboard
common
receiveRevocation
Link copied to clipboard
common
fun receiveRevocation(revocation: RevokeAndAck): Either<ChannelException, Pair<Commitments, List<ChannelAction>>>
remoteHasChanges
Link copied to clipboard
common
fun remoteHasChanges(): Boolean
remoteHasUnsignedOutgoingHtlcs
Link copied to clipboard
common
fun remoteHasUnsignedOutgoingHtlcs(): Boolean
remoteHasUnsignedOutgoingUpdateFee
Link copied to clipboard
common
fun remoteHasUnsignedOutgoingUpdateFee(): Boolean
sendAdd
Link copied to clipboard
common
fun sendAdd(cmd: CMD_ADD_HTLC, paymentId: UUID, blockHeight: Long): Either<ChannelException, Pair<Commitments, UpdateAddHtlc>>
sendCommit
Link copied to clipboard
common
fun sendCommit(keyManager: KeyManager, log: Logger): Either<ChannelException, Pair<Commitments, CommitSig>>
sendFail
Link copied to clipboard
common
fun sendFail(cmd: CMD_FAIL_HTLC, nodeSecret: PrivateKey): Either<ChannelException, Pair<Commitments, UpdateFailHtlc>>
sendFailMalformed
Link copied to clipboard
sendFee
Link copied to clipboard
common
fun sendFee(cmd: CMD_UPDATE_FEE): Either<ChannelException, Pair<Commitments, UpdateFee>>
sendFulfill
Link copied to clipboard
common
timedOutOutgoingHtlcs
Link copied to clipboard
common
fun timedOutOutgoingHtlcs(blockHeight: Long): Set<UpdateAddHtlc>
updateFeatures
Link copied to clipboard
common
fun updateFeatures(localInit: Init, remoteInit: Init): Commitments

Properties

channelConfig
Link copied to clipboard
common
val channelConfig: ChannelConfig
channelFeatures
Link copied to clipboard
common
val channelFeatures: ChannelFeatures
channelFlags
Link copied to clipboard
common
val channelFlags: Byte
channelId
Link copied to clipboard
common
val channelId: ByteVector32
commitInput
Link copied to clipboard
common
val commitInput: Transactions.InputInfo
localChanges
Link copied to clipboard
common
val localChanges: LocalChanges
localCommit
Link copied to clipboard
common
val localCommit: LocalCommit
localNextHtlcId
Link copied to clipboard
common
val localNextHtlcId: Long
localParams
Link copied to clipboard
common
val localParams: LocalParams
payments
Link copied to clipboard
common
val payments: Map<Long, UUID>
remoteChanges
Link copied to clipboard
common
val remoteChanges: RemoteChanges
remoteChannelData
Link copied to clipboard
common
val remoteChannelData: EncryptedChannelData
remoteCommit
Link copied to clipboard
common
val remoteCommit: RemoteCommit
remoteNextCommitInfo
Link copied to clipboard
common
val remoteNextCommitInfo: Either<WaitingForRevocation, PublicKey>
remoteNextHtlcId
Link copied to clipboard
common
val remoteNextHtlcId: Long
remoteParams
Link copied to clipboard
common
val remoteParams: RemoteParams
remotePerCommitmentSecrets
Link copied to clipboard
common
val remotePerCommitmentSecrets: ShaChain