Skip to content

Commit 86dd33b

Browse files
committed
Rename ChannelTypes -> ChannelData
And move commands to a new ChannelCommands file. This commit doesn't contain any logic changes.
1 parent 023e456 commit 86dd33b

File tree

3 files changed

+35
-47
lines changed

3 files changed

+35
-47
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package fr.acinq.lightning.channel
2+
3+
import fr.acinq.bitcoin.ByteVector
4+
import fr.acinq.bitcoin.ByteVector32
5+
import fr.acinq.lightning.CltvExpiry
6+
import fr.acinq.lightning.MilliSatoshi
7+
import fr.acinq.lightning.blockchain.fee.FeeratePerKw
8+
import fr.acinq.lightning.utils.UUID
9+
import fr.acinq.lightning.wire.FailureMessage
10+
import fr.acinq.lightning.wire.OnionRoutingPacket
11+
12+
sealed class Command
13+
14+
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()
15+
16+
sealed class HtlcSettlementCommand : Command() {
17+
abstract val id: Long
18+
}
19+
20+
data class CMD_FULFILL_HTLC(override val id: Long, val r: ByteVector32, val commit: Boolean = false) : HtlcSettlementCommand()
21+
data class CMD_FAIL_MALFORMED_HTLC(override val id: Long, val onionHash: ByteVector32, val failureCode: Int, val commit: Boolean = false) : HtlcSettlementCommand()
22+
data class CMD_FAIL_HTLC(override val id: Long, val reason: Reason, val commit: Boolean = false) : HtlcSettlementCommand() {
23+
sealed class Reason {
24+
data class Bytes(val bytes: ByteVector) : Reason()
25+
data class Failure(val message: FailureMessage) : Reason()
26+
}
27+
}
28+
29+
object CMD_SIGN : Command()
30+
data class CMD_UPDATE_FEE(val feerate: FeeratePerKw, val commit: Boolean = false) : Command()
31+
32+
sealed class CloseCommand : Command()
33+
data class CMD_CLOSE(val scriptPubKey: ByteVector?) : CloseCommand()
34+
object CMD_FORCECLOSE : CloseCommand()

src/commonMain/kotlin/fr/acinq/lightning/channel/ChannelTypes.kt renamed to src/commonMain/kotlin/fr/acinq/lightning/channel/ChannelData.kt

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,6 @@ import fr.acinq.lightning.wire.FailureMessage
1818
import fr.acinq.lightning.wire.OnionRoutingPacket
1919
import kotlinx.serialization.Serializable
2020

21-
/*
22-
.d8888b. .d88888b. 888b d888 888b d888 d8888 888b 888 8888888b. .d8888b.
23-
d88P Y88b d88P" "Y88b 8888b d8888 8888b d8888 d88888 8888b 888 888 "Y88b d88P Y88b
24-
888 888 888 888 88888b.d88888 88888b.d88888 d88P888 88888b 888 888 888 Y88b.
25-
888 888 888 888Y88888P888 888Y88888P888 d88P 888 888Y88b 888 888 888 "Y888b.
26-
888 888 888 888 Y888P 888 888 Y888P 888 d88P 888 888 Y88b888 888 888 "Y88b.
27-
888 888 888 888 888 Y8P 888 888 Y8P 888 d88P 888 888 Y88888 888 888 "888
28-
Y88b d88P Y88b. .d88P 888 " 888 888 " 888 d8888888888 888 Y8888 888 .d88P Y88b d88P
29-
"Y8888P" "Y88888P" 888 888 888 888 d88P 888 888 Y888 8888888P" "Y8888P"
30-
*/
31-
32-
sealed class Command
33-
34-
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()
35-
36-
sealed class HtlcSettlementCommand : Command() {
37-
abstract val id: Long
38-
}
39-
40-
data class CMD_FULFILL_HTLC(override val id: Long, val r: ByteVector32, val commit: Boolean = false) : HtlcSettlementCommand()
41-
data class CMD_FAIL_MALFORMED_HTLC(override val id: Long, val onionHash: ByteVector32, val failureCode: Int, val commit: Boolean = false) : HtlcSettlementCommand()
42-
data class CMD_FAIL_HTLC(override val id: Long, val reason: Reason, val commit: Boolean = false) : HtlcSettlementCommand() {
43-
sealed class Reason {
44-
data class Bytes(val bytes: ByteVector) : Reason()
45-
data class Failure(val message: FailureMessage) : Reason()
46-
}
47-
}
48-
49-
object CMD_SIGN : Command()
50-
data class CMD_UPDATE_FEE(val feerate: FeeratePerKw, val commit: Boolean = false) : Command()
51-
52-
sealed class CloseCommand : Command()
53-
data class CMD_CLOSE(val scriptPubKey: ByteVector?) : CloseCommand()
54-
object CMD_FORCECLOSE : CloseCommand()
55-
56-
/*
57-
8888888b. d8888 88888888888 d8888
58-
888 "Y88b d88888 888 d88888
59-
888 888 d88P888 888 d88P888
60-
888 888 d88P 888 888 d88P 888
61-
888 888 d88P 888 888 d88P 888
62-
888 888 d88P 888 888 d88P 888
63-
888 .d88P d8888888888 888 d8888888888
64-
8888888P" d88P 888 888 d88P 888
65-
*/
66-
6721
/**
6822
* Details about a force-close where we published our commitment.
6923
*

src/commonTest/kotlin/fr/acinq/lightning/channel/ChannelTypesTestsCommon.kt renamed to src/commonTest/kotlin/fr/acinq/lightning/channel/ChannelDataTestsCommon.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import fr.acinq.lightning.utils.msat
2525
import fr.acinq.lightning.utils.sat
2626
import kotlin.test.*
2727

28-
class ChannelTypesTestsCommon : LightningTestSuite() {
28+
class ChannelDataTestsCommon : LightningTestSuite() {
2929

3030
@Test
3131
fun `standard channel features include deterministic channel key path`() {

0 commit comments

Comments
 (0)