Skip to content

Commit

Permalink
Use official liquidity ads types
Browse files Browse the repository at this point in the history
Update our codecs to use the official version of the liquidity ads
messages and fields. The specification can be found here:
lightning/bolts#1153.
  • Loading branch information
t-bast committed Oct 10, 2024
1 parent 1b749e1 commit 9fe82b0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ object OpenDualFundedChannelTlv {
.typecase(UInt64(0), upfrontShutdownScriptCodec)
.typecase(UInt64(1), channelTypeCodec)
.typecase(UInt64(2), requireConfirmedInputsCodec)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), requestFundingCodec)
.typecase(UInt64(5), requestFundingCodec)
.typecase(UInt64(0x47000007), pushAmountCodec)
)
}
Expand All @@ -142,8 +141,7 @@ object TxInitRbfTlv {
val txInitRbfTlvCodec: Codec[TlvStream[TxInitRbfTlv]] = tlvStream(discriminated[TxInitRbfTlv].by(varint)
.typecase(UInt64(0), tlvField(satoshiSigned.as[SharedOutputContributionTlv]))
.typecase(UInt64(2), requireConfirmedInputsCodec)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), requestFundingCodec)
.typecase(UInt64(5), requestFundingCodec)
)
}

Expand All @@ -155,8 +153,7 @@ object TxAckRbfTlv {
val txAckRbfTlvCodec: Codec[TlvStream[TxAckRbfTlv]] = tlvStream(discriminated[TxAckRbfTlv].by(varint)
.typecase(UInt64(0), tlvField(satoshiSigned.as[SharedOutputContributionTlv]))
.typecase(UInt64(2), requireConfirmedInputsCodec)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), provideFundingCodec)
.typecase(UInt64(5), provideFundingCodec)
)
}

Expand All @@ -166,8 +163,7 @@ object SpliceInitTlv {

val spliceInitTlvCodec: Codec[TlvStream[SpliceInitTlv]] = tlvStream(discriminated[SpliceInitTlv].by(varint)
.typecase(UInt64(2), requireConfirmedInputsCodec)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), requestFundingCodec)
.typecase(UInt64(5), requestFundingCodec)
.typecase(UInt64(0x47000007), tlvField(tmillisatoshi.as[PushAmountTlv]))
)
}
Expand All @@ -178,8 +174,7 @@ object SpliceAckTlv {

val spliceAckTlvCodec: Codec[TlvStream[SpliceAckTlv]] = tlvStream(discriminated[SpliceAckTlv].by(varint)
.typecase(UInt64(2), requireConfirmedInputsCodec)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), provideFundingCodec)
.typecase(UInt64(5), provideFundingCodec)
.typecase(UInt64(41042), feeCreditUsedCodec)
.typecase(UInt64(0x47000007), tlvField(tmillisatoshi.as[PushAmountTlv]))
)
Expand All @@ -197,8 +192,7 @@ object AcceptDualFundedChannelTlv {
.typecase(UInt64(0), upfrontShutdownScriptCodec)
.typecase(UInt64(1), channelTypeCodec)
.typecase(UInt64(2), requireConfirmedInputsCodec)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), provideFundingCodec)
.typecase(UInt64(5), provideFundingCodec)
.typecase(UInt64(41042), feeCreditUsedCodec)
.typecase(UInt64(0x47000007), pushAmountCodec)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ object NodeAnnouncementTlv {
case class OptionWillFund(rates: LiquidityAds.WillFundRates) extends NodeAnnouncementTlv

val nodeAnnouncementTlvCodec: Codec[TlvStream[NodeAnnouncementTlv]] = tlvStream(discriminated[NodeAnnouncementTlv].by(varint)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), tlvField(LiquidityAds.Codecs.willFundRates.as[OptionWillFund]))
.typecase(UInt64(5), tlvField(LiquidityAds.Codecs.willFundRates.as[OptionWillFund]))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ object InitTlvCodecs {
val initTlvCodec = tlvStream(discriminated[InitTlv].by(varint)
.typecase(UInt64(1), networks)
.typecase(UInt64(3), remoteAddress)
// We use a temporary TLV while the spec is being reviewed.
.typecase(UInt64(1339), willFund)
.typecase(UInt64(5), willFund)
)

}
Expand Down
Loading

0 comments on commit 9fe82b0

Please sign in to comment.