| | 1 | | namespace NLightning.Domain.Protocol.Payloads; |
| | 2 | |
|
| | 3 | | using Domain.Channels.ValueObjects; |
| | 4 | | using Domain.Crypto.ValueObjects; |
| | 5 | | using Interfaces; |
| | 6 | | using Money; |
| | 7 | |
|
| | 8 | | /// <summary> |
| | 9 | | /// Represents the payload for the accept_channel message. |
| | 10 | | /// </summary> |
| | 11 | | /// <remarks> |
| | 12 | | /// Initializes a new instance of the AcceptChannel1Payload class. |
| | 13 | | /// </remarks> |
| | 14 | | public class AcceptChannel1Payload : IChannelMessagePayload |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// The temporary_channel_id is used to identify this channel on a per-peer basis until the funding transaction |
| | 18 | | /// is established, at which point it is replaced by the channel_id, which is derived from the funding transaction. |
| | 19 | | /// </summary> |
| 20 | 20 | | public ChannelId ChannelId { get; set; } |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// dust_limit_satoshis is the threshold below which outputs should not be generated for this node's commitment or |
| | 24 | | /// HTLC transactions |
| | 25 | | /// </summary> |
| 0 | 26 | | public LightningMoney DustLimitAmount { get; } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// max_htlc_value_in_flight_msat is a cap on total value of outstanding HTLCs offered by the remote node, which |
| | 30 | | /// allows the local node to limit its exposure to HTLCs |
| | 31 | | /// </summary> |
| 0 | 32 | | public LightningMoney MaxHtlcValueInFlightAmount { get; } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// channel_reserve_satoshis is the amount the acceptor is reserving for the channel, which is not available for |
| | 36 | | /// spending |
| | 37 | | /// </summary> |
| 20 | 38 | | public LightningMoney ChannelReserveAmount { get; set; } |
| | 39 | |
|
| | 40 | | /// <summary> |
| | 41 | | /// htlc_minimum_msat indicates the smallest value HTLC this node will accept. |
| | 42 | | /// </summary> |
| 0 | 43 | | public LightningMoney HtlcMinimumAmount { get; } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// minimum_depth is the number of blocks we consider reasonable to avoid double-spending of the funding transaction |
| | 47 | | /// In case channel_type includes option_zeroconf this MUST be 0 |
| | 48 | | /// </summary> |
| 20 | 49 | | public uint MinimumDepth { get; set; } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// to_self_delay is how long (in blocks) the other node will have to wait in case of breakdown before redeeming |
| | 53 | | /// its own funds. |
| | 54 | | /// </summary> |
| 0 | 55 | | public ushort ToSelfDelay { get; } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// max_accepted_htlcs limits the number of outstanding HTLCs the remote node can offer. |
| | 59 | | /// </summary> |
| 0 | 60 | | public ushort MaxAcceptedHtlcs { get; } |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// funding_pubkey is the public key in the 2-of-2 multisig script of the funding transaction output. |
| | 64 | | /// </summary> |
| 20 | 65 | | public CompactPubKey FundingPubKey { get; set; } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// revocation_basepoint is used to regenerate the scripts required for the penalty transaction |
| | 69 | | /// </summary> |
| 20 | 70 | | public CompactPubKey RevocationBasepoint { get; set; } |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// payment_basepoint is used to produce payment signatures for the protocol |
| | 74 | | /// </summary> |
| 20 | 75 | | public CompactPubKey PaymentBasepoint { get; set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// delayed_payment_basepoint is used to regenerate the scripts required for the penalty transaction |
| | 79 | | /// </summary> |
| 20 | 80 | | public CompactPubKey DelayedPaymentBasepoint { get; set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// htlc_basepoint is used to produce HTLC signatures for the protocol |
| | 84 | | /// </summary> |
| 20 | 85 | | public CompactPubKey HtlcBasepoint { get; set; } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// first_per_commitment_point is the per-commitment point used for the first commitment transaction |
| | 89 | | /// </summary> |
| 20 | 90 | | public CompactPubKey FirstPerCommitmentPoint { get; set; } |
| | 91 | |
|
| 20 | 92 | | public AcceptChannel1Payload(ChannelId channelId, LightningMoney channelReserveAmount, |
| 20 | 93 | | CompactPubKey delayedPaymentBasepoint, LightningMoney dustLimitAmount, |
| 20 | 94 | | CompactPubKey firstPerCommitmentPoint, CompactPubKey fundingPubKey, |
| 20 | 95 | | CompactPubKey htlcBasepoint, LightningMoney htlcMinimumAmount, ushort maxAcceptedHtlcs, |
| 20 | 96 | | LightningMoney maxHtlcValueInFlight, uint minimumDepth, CompactPubKey paymentBasepoint, |
| 20 | 97 | | CompactPubKey revocationBasepoint, ushort toSelfDelay) |
| | 98 | | { |
| 20 | 99 | | ChannelId = channelId; |
| 20 | 100 | | DustLimitAmount = dustLimitAmount; |
| 20 | 101 | | MaxHtlcValueInFlightAmount = maxHtlcValueInFlight; |
| 20 | 102 | | ChannelReserveAmount = channelReserveAmount; |
| 20 | 103 | | HtlcMinimumAmount = htlcMinimumAmount; |
| 20 | 104 | | MinimumDepth = minimumDepth; |
| 20 | 105 | | ToSelfDelay = toSelfDelay; |
| 20 | 106 | | MaxAcceptedHtlcs = maxAcceptedHtlcs; |
| 20 | 107 | | FundingPubKey = fundingPubKey; |
| 20 | 108 | | RevocationBasepoint = revocationBasepoint; |
| 20 | 109 | | PaymentBasepoint = paymentBasepoint; |
| 20 | 110 | | DelayedPaymentBasepoint = delayedPaymentBasepoint; |
| 20 | 111 | | HtlcBasepoint = htlcBasepoint; |
| 20 | 112 | | FirstPerCommitmentPoint = firstPerCommitmentPoint; |
| 20 | 113 | | } |
| | 114 | | } |