-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And move commands to a new ChannelCommands file. This commit doesn't contain any logic changes.
- Loading branch information
Showing
3 changed files
with
35 additions
and
47 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/commonMain/kotlin/fr/acinq/lightning/channel/ChannelCommands.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package fr.acinq.lightning.channel | ||
|
||
import fr.acinq.bitcoin.ByteVector | ||
import fr.acinq.bitcoin.ByteVector32 | ||
import fr.acinq.lightning.CltvExpiry | ||
import fr.acinq.lightning.MilliSatoshi | ||
import fr.acinq.lightning.blockchain.fee.FeeratePerKw | ||
import fr.acinq.lightning.utils.UUID | ||
import fr.acinq.lightning.wire.FailureMessage | ||
import fr.acinq.lightning.wire.OnionRoutingPacket | ||
|
||
sealed class Command | ||
|
||
data class CMD_ADD_HTLC(val amount: MilliSatoshi, val paymentHash: ByteVector32, val cltvExpiry: CltvExpiry, val onion: OnionRoutingPacket, val paymentId: UUID, val commit: Boolean = false) : Command() | ||
|
||
sealed class HtlcSettlementCommand : Command() { | ||
abstract val id: Long | ||
} | ||
|
||
data class CMD_FULFILL_HTLC(override val id: Long, val r: ByteVector32, val commit: Boolean = false) : HtlcSettlementCommand() | ||
data class CMD_FAIL_MALFORMED_HTLC(override val id: Long, val onionHash: ByteVector32, val failureCode: Int, val commit: Boolean = false) : HtlcSettlementCommand() | ||
data class CMD_FAIL_HTLC(override val id: Long, val reason: Reason, val commit: Boolean = false) : HtlcSettlementCommand() { | ||
sealed class Reason { | ||
data class Bytes(val bytes: ByteVector) : Reason() | ||
data class Failure(val message: FailureMessage) : Reason() | ||
} | ||
} | ||
|
||
object CMD_SIGN : Command() | ||
data class CMD_UPDATE_FEE(val feerate: FeeratePerKw, val commit: Boolean = false) : Command() | ||
|
||
sealed class CloseCommand : Command() | ||
data class CMD_CLOSE(val scriptPubKey: ByteVector?) : CloseCommand() | ||
object CMD_FORCECLOSE : CloseCommand() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters