1
0
mirror of https://github.com/ACINQ/eclair.git synced 2025-01-19 05:33:59 +01:00

Use 8 bytes for msat amounts (#99)

(see RFC PR 175)
This commit is contained in:
Fabrice Drouin 2017-06-27 10:48:56 +02:00 committed by Pierre-Marie Padiou
parent 53243b5e74
commit 83238b6299
3 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@ object ChannelCodecs {
("dustLimitSatoshis" | uint64) ::
("maxHtlcValueInFlightMsat" | uint64) ::
("channelReserveSatoshis" | uint64) ::
("htlcMinimumMsat" | uint32) ::
("htlcMinimumMsat" | uint64) ::
("toSelfDelay" | uint16) ::
("maxAcceptedHtlcs" | uint16) ::
("fundingPrivKey" | privateKey) ::
@ -39,7 +39,7 @@ object ChannelCodecs {
("dustLimitSatoshis" | uint64) ::
("maxHtlcValueInFlightMsat" | uint64) ::
("channelReserveSatoshis" | uint64) ::
("htlcMinimumMsat" | uint32) ::
("htlcMinimumMsat" | uint64) ::
("toSelfDelay" | uint16) ::
("maxAcceptedHtlcs" | uint16) ::
("fundingPubKey" | publicKey) ::

View File

@ -1,7 +1,7 @@
package fr.acinq.eclair.wire
import fr.acinq.bitcoin.BinaryData
import fr.acinq.eclair.wire.LightningMessageCodecs.{binarydata, channelUpdateCodec}
import fr.acinq.eclair.wire.LightningMessageCodecs.{binarydata, uint64, channelUpdateCodec}
import scodec.Codec
import scodec.codecs._
@ -61,8 +61,8 @@ object FailureMessageCodecs {
.typecase(PERM | 8, provide(PermanentChannelFailure))
.typecase(PERM | 9, provide(RequiredChannelFeatureMissing))
.typecase(PERM | 10, provide(UnknownNextPeer))
.typecase(UPDATE | 11, (("amountMsat" | uint32) :: ("channelUpdate" | channelUpdateCodec)).as[AmountBelowMinimum])
.typecase(UPDATE | 12, (("amountMsat" | uint32) :: ("channelUpdate" | channelUpdateCodec)).as[FeeInsufficient])
.typecase(UPDATE | 11, (("amountMsat" | uint64) :: ("channelUpdate" | channelUpdateCodec)).as[AmountBelowMinimum])
.typecase(UPDATE | 12, (("amountMsat" | uint64) :: ("channelUpdate" | channelUpdateCodec)).as[FeeInsufficient])
.typecase(UPDATE | 13, (("expiry" | uint32) :: ("channelUpdate" | channelUpdateCodec)).as[IncorrectCltvExpiry])
.typecase(UPDATE | 14, (("channelUpdate" | channelUpdateCodec)).as[ExpiryTooSoon])
.typecase(UPDATE | 20, (("flags" | binarydata(2)) :: ("channelUpdate" | channelUpdateCodec)).as[ChannelDisabled])

View File

@ -116,7 +116,7 @@ object LightningMessageCodecs {
("dustLimitSatoshis" | uint64) ::
("maxHtlcValueInFlightMsat" | uint64) ::
("channelReserveSatoshis" | uint64) ::
("htlcMinimumMsat" | uint32) ::
("htlcMinimumMsat" | uint64) ::
("feeratePerKw" | uint32) ::
("toSelfDelay" | uint16) ::
("maxAcceptedHtlcs" | uint16) ::
@ -131,8 +131,8 @@ object LightningMessageCodecs {
("dustLimitSatoshis" | uint64) ::
("maxHtlcValueInFlightMsat" | uint64) ::
("channelReserveSatoshis" | uint64) ::
("htlcMinimumMsat" | uint64) ::
("minimumDepth" | uint32) ::
("htlcMinimumMsat" | uint32) ::
("toSelfDelay" | uint16) ::
("maxAcceptedHtlcs" | uint16) ::
("fundingPubkey" | publicKey) ::
@ -167,7 +167,7 @@ object LightningMessageCodecs {
val updateAddHtlcCodec: Codec[UpdateAddHtlc] = (
("channelId" | binarydata(32)) ::
("id" | uint64) ::
("amountMsat" | uint32) ::
("amountMsat" | uint64) ::
("expiry" | uint32) ::
("paymentHash" | binarydata(32)) ::
("onionRoutingPacket" | binarydata(Sphinx.PacketLength))).as[UpdateAddHtlc]
@ -241,7 +241,7 @@ object LightningMessageCodecs {
("timestamp" | uint32) ::
("flags" | binarydata(2)) ::
("cltvExpiryDelta" | uint16) ::
("htlcMinimumMsat" | uint32) ::
("htlcMinimumMsat" | uint64) ::
("feeBaseMsat" | uint32) ::
("feeProportionalMillionths" | uint32))
@ -277,8 +277,8 @@ object LightningMessageCodecs {
val perHopPayloadCodec: Codec[PerHopPayload] = (
("realm" | constant(ByteVector.fromByte(0))) ::
("channel_id" | uint64) ::
("amt_to_forward" | uint32) ::
("amt_to_forward" | uint64) ::
("outgoing_cltv_value" | int32) :: // we use a signed int32, it is enough to store cltv for 40 000 years
("unused_with_v0_version_on_header" | ignore(8 * 16))).as[PerHopPayload]
("unused_with_v0_version_on_header" | ignore(8 * 12))).as[PerHopPayload]
}