| | 1 | | namespace NLightning.Domain.Protocol.Messages; |
| | 2 | |
|
| | 3 | | using Constants; |
| | 4 | | using Models; |
| | 5 | | using Payloads; |
| | 6 | | using Tlv; |
| | 7 | |
|
| | 8 | | /// <summary> |
| | 9 | | /// Represents an open_channel2 message. |
| | 10 | | /// </summary> |
| | 11 | | /// <remarks> |
| | 12 | | /// The accept_channel2 message is sent to the initiator to accept the channel opening. |
| | 13 | | /// The message type is 65. |
| | 14 | | /// </remarks> |
| | 15 | | public sealed class AcceptChannel2Message : BaseMessage |
| | 16 | | { |
| | 17 | | /// <summary> |
| | 18 | | /// The payload of the message. |
| | 19 | | /// </summary> |
| 112 | 20 | | public new AcceptChannel2Payload Payload { get => (AcceptChannel2Payload)base.Payload; } |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// Optional UpfrontShutdownScriptTlv |
| | 24 | | /// </summary> |
| 32 | 25 | | public UpfrontShutdownScriptTlv? UpfrontShutdownScriptTlv { get; } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Optional ChannelTypeTlv |
| | 29 | | /// </summary> |
| 24 | 30 | | public ChannelTypeTlv? ChannelTypeTlv { get; } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Optional RequireConfirmedInputsTlv |
| | 34 | | /// </summary> |
| 20 | 35 | | public RequireConfirmedInputsTlv? RequireConfirmedInputsTlv { get; } |
| | 36 | |
|
| | 37 | | public AcceptChannel2Message(AcceptChannel2Payload payload, UpfrontShutdownScriptTlv? upfrontShutdownScriptTlv = nul |
| 16 | 38 | | : base(MessageTypes.ACCEPT_CHANNEL_2, payload) |
| | 39 | | { |
| 16 | 40 | | UpfrontShutdownScriptTlv = upfrontShutdownScriptTlv; |
| 16 | 41 | | ChannelTypeTlv = channelTypeTlv; |
| 16 | 42 | | RequireConfirmedInputsTlv = requireConfirmedInputsTlv; |
| | 43 | |
|
| 16 | 44 | | if (UpfrontShutdownScriptTlv is not null || ChannelTypeTlv is not null || RequireConfirmedInputsTlv is not null) |
| | 45 | | { |
| 8 | 46 | | Extension = new TlvStream(); |
| 8 | 47 | | Extension.Add(UpfrontShutdownScriptTlv, ChannelTypeTlv, RequireConfirmedInputsTlv); |
| | 48 | | } |
| 16 | 49 | | } |
| | 50 | | } |