| | 1 | | namespace NLightning.Domain.Protocol.Payloads; |
| | 2 | |
|
| | 3 | | using Channels.ValueObjects; |
| | 4 | | using Crypto.ValueObjects; |
| | 5 | | using Interfaces; |
| | 6 | | using Money; |
| | 7 | | using ValueObjects; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// Represents the payload for the open_channel message. |
| | 11 | | /// </summary> |
| | 12 | | /// <remarks> |
| | 13 | | /// Initializes a new instance of the OpenChannel1Payload class. |
| | 14 | | /// </remarks> |
| | 15 | | public class OpenChannel1Payload : IChannelMessagePayload |
| | 16 | | { |
| | 17 | | /// <summary> |
| | 18 | | /// The chain_hash value denotes the exact blockchain that the opened channel will reside within. |
| | 19 | | /// </summary> |
| 0 | 20 | | public ChainHash ChainHash { get; } |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// The temporary_channel_id is used to identify this channel on a per-peer basis until the funding transaction |
| | 24 | | /// is established, at which point it is replaced by the channel_id, which is derived from the funding transaction. |
| | 25 | | /// </summary> |
| 48 | 26 | | public ChannelId ChannelId { get; } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// funding_satoshis is the amount the sender is putting into the channel. |
| | 30 | | /// </summary> |
| | 31 | | /// <remarks>Amount is used in Satoshis</remarks> |
| 0 | 32 | | public LightningMoney FundingAmount { get; } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// push_msat is the amount the sender is pushing to the receiver of the channel. |
| | 36 | | /// </summary> |
| | 37 | | /// <remarks>Amount is used in Millisatoshis</remarks> |
| 0 | 38 | | public LightningMoney PushAmount { get; } |
| | 39 | |
|
| | 40 | | /// <summary> |
| | 41 | | /// dust_limit_satoshis is the threshold below which outputs should not be generated for this node's commitment or |
| | 42 | | /// HTLC transactions |
| | 43 | | /// </summary> |
| 0 | 44 | | public LightningMoney DustLimitAmount { get; } |
| | 45 | |
|
| | 46 | | /// <summary> |
| | 47 | | /// max_htlc_value_in_flight_msat is a cap on total value of outstanding HTLCs offered by the remote node, which |
| | 48 | | /// allows the local node to limit its exposure to HTLCs |
| | 49 | | /// </summary> |
| 0 | 50 | | public LightningMoney MaxHtlcValueInFlight { get; } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// channel_reserve_satoshis is the amount that must remain in the channel after a commitment transaction |
| | 54 | | /// </summary> |
| 0 | 55 | | public LightningMoney ChannelReserveAmount { get; } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// htlc_minimum_msat indicates the smallest value HTLC this node will accept. |
| | 59 | | /// </summary> |
| 0 | 60 | | public LightningMoney HtlcMinimumAmount { get; } |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// feerate_per_kw is the fee rate that will be paid for the commitment transaction in |
| | 64 | | /// satoshi per 1000-weight |
| | 65 | | /// </summary> |
| 0 | 66 | | public LightningMoney FeeRatePerKw { get; } |
| | 67 | |
|
| | 68 | | /// <summary> |
| | 69 | | /// to_self_delay is how long (in blocks) the other node will have to wait in case of breakdown before redeeming |
| | 70 | | /// its own funds. |
| | 71 | | /// </summary> |
| 0 | 72 | | public ushort ToSelfDelay { get; } |
| | 73 | |
|
| | 74 | | /// <summary> |
| | 75 | | /// max_accepted_htlcs limits the number of outstanding HTLCs the remote node can offer. |
| | 76 | | /// </summary> |
| 0 | 77 | | public ushort MaxAcceptedHtlcs { get; } |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// funding_pubkey is the public key in the 2-of-2 multisig script of the funding transaction output. |
| | 81 | | /// </summary> |
| 0 | 82 | | public CompactPubKey FundingPubKey { get; } |
| | 83 | |
|
| | 84 | | /// <summary> |
| | 85 | | /// revocation_basepoint is used to regenerate the scripts required for the penalty transaction |
| | 86 | | /// </summary> |
| 0 | 87 | | public CompactPubKey RevocationBasepoint { get; } |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// payment_basepoint is used to produce payment signatures for the protocol |
| | 91 | | /// </summary> |
| 0 | 92 | | public CompactPubKey PaymentBasepoint { get; } |
| | 93 | |
|
| | 94 | | /// <summary> |
| | 95 | | /// delayed_payment_basepoint is used to regenerate the scripts required for the penalty transaction |
| | 96 | | /// </summary> |
| 0 | 97 | | public CompactPubKey DelayedPaymentBasepoint { get; } |
| | 98 | |
|
| | 99 | | /// <summary> |
| | 100 | | /// htlc_basepoint is used to produce HTLC signatures for the protocol |
| | 101 | | /// </summary> |
| 0 | 102 | | public CompactPubKey HtlcBasepoint { get; } |
| | 103 | |
|
| | 104 | | /// <summary> |
| | 105 | | /// first_per_commitment_point is the per-commitment point used for the first commitment transaction |
| | 106 | | /// </summary> |
| 0 | 107 | | public CompactPubKey FirstPerCommitmentPoint { get; } |
| | 108 | |
|
| | 109 | | /// <summary> |
| | 110 | | /// Only the least-significant bit of channel_flags is currently defined: announce_channel. This indicates whether |
| | 111 | | /// the initiator of the funding flow wishes to advertise this channel publicly to the network |
| | 112 | | /// </summary> |
| 0 | 113 | | public ChannelFlags ChannelFlags { get; } |
| | 114 | |
|
| 20 | 115 | | public OpenChannel1Payload(ChainHash chainHash, ChannelFlags channelFlags, ChannelId channelId, |
| 20 | 116 | | LightningMoney channelReserveAmount, CompactPubKey delayedPaymentBasepoint, |
| 20 | 117 | | LightningMoney dustLimitAmount, LightningMoney feeRatePerKw, |
| 20 | 118 | | CompactPubKey firstPerCommitmentPoint, LightningMoney fundingAmount, |
| 20 | 119 | | CompactPubKey fundingPubKey, CompactPubKey htlcBasepoint, |
| 20 | 120 | | LightningMoney htlcMinimumAmount, ushort maxAcceptedHtlcs, |
| 20 | 121 | | LightningMoney maxHtlcValueInFlight, CompactPubKey paymentBasepoint, |
| 20 | 122 | | LightningMoney pushAmount, CompactPubKey revocationBasepoint, ushort toSelfDelay) |
| | 123 | | { |
| 20 | 124 | | ChainHash = chainHash; |
| 20 | 125 | | ChannelId = channelId; |
| 20 | 126 | | FundingAmount = fundingAmount; |
| 20 | 127 | | PushAmount = pushAmount; |
| 20 | 128 | | DustLimitAmount = dustLimitAmount; |
| 20 | 129 | | MaxHtlcValueInFlight = maxHtlcValueInFlight; |
| 20 | 130 | | ChannelReserveAmount = channelReserveAmount; |
| 20 | 131 | | HtlcMinimumAmount = htlcMinimumAmount; |
| 20 | 132 | | FeeRatePerKw = feeRatePerKw; |
| 20 | 133 | | ToSelfDelay = toSelfDelay; |
| 20 | 134 | | MaxAcceptedHtlcs = maxAcceptedHtlcs; |
| 20 | 135 | | FundingPubKey = fundingPubKey; |
| 20 | 136 | | RevocationBasepoint = revocationBasepoint; |
| 20 | 137 | | PaymentBasepoint = paymentBasepoint; |
| 20 | 138 | | DelayedPaymentBasepoint = delayedPaymentBasepoint; |
| 20 | 139 | | HtlcBasepoint = htlcBasepoint; |
| 20 | 140 | | FirstPerCommitmentPoint = firstPerCommitmentPoint; |
| 20 | 141 | | ChannelFlags = channelFlags; |
| 20 | 142 | | } |
| | 143 | | } |