| | 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_channel message. |
| | 10 | | /// </summary> |
| | 11 | | /// <remarks> |
| | 12 | | /// The accept_channel message is sent to the initiator in order to accept the channel opening. |
| | 13 | | /// The message type is 33. |
| | 14 | | /// </remarks> |
| | 15 | | public sealed class AcceptChannel1Message : BaseChannelMessage |
| | 16 | | { |
| | 17 | | /// <summary> |
| | 18 | | /// The payload of the message. |
| | 19 | | /// </summary> |
| 0 | 20 | | public new AcceptChannel1Payload Payload { get => (AcceptChannel1Payload)base.Payload; } |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// Optional UpfrontShutdownScriptTlv |
| | 24 | | /// </summary> |
| 20 | 25 | | public UpfrontShutdownScriptTlv? UpfrontShutdownScriptTlv { get; } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Optional ChannelTypeTlv |
| | 29 | | /// </summary> |
| 20 | 30 | | public ChannelTypeTlv? ChannelTypeTlv { get; } |
| | 31 | |
|
| | 32 | | public AcceptChannel1Message(AcceptChannel1Payload payload, |
| | 33 | | UpfrontShutdownScriptTlv? upfrontShutdownScriptTlv = null, |
| | 34 | | ChannelTypeTlv? channelTypeTlv = null) |
| 20 | 35 | | : base(MessageTypes.AcceptChannel, payload) |
| | 36 | | { |
| 20 | 37 | | UpfrontShutdownScriptTlv = upfrontShutdownScriptTlv; |
| 20 | 38 | | ChannelTypeTlv = channelTypeTlv; |
| | 39 | |
|
| 20 | 40 | | if (UpfrontShutdownScriptTlv is not null || ChannelTypeTlv is not null) |
| | 41 | | { |
| 0 | 42 | | Extension = new TlvStream(); |
| 0 | 43 | | Extension.Add(UpfrontShutdownScriptTlv, ChannelTypeTlv); |
| | 44 | | } |
| 20 | 45 | | } |
| | 46 | | } |