| | 1 | | using NBitcoin; |
| | 2 | |
|
| | 3 | | namespace NLightning.Domain.Protocol.Payloads; |
| | 4 | |
|
| | 5 | | using Interfaces; |
| | 6 | | using Money; |
| | 7 | | using ValueObjects; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// Represents the payload for the accept_channel2 message. |
| | 11 | | /// </summary> |
| | 12 | | /// <remarks> |
| | 13 | | /// Initializes a new instance of the AcceptChannel2Payload class. |
| | 14 | | /// </remarks> |
| 20 | 15 | | public class AcceptChannel2Payload(PubKey delayedPaymentBasepoint, LightningMoney dustLimitAmount, |
| 20 | 16 | | PubKey firstPerCommitmentPoint, LightningMoney fundingAmount, PubKey fundingPubKey, |
| 20 | 17 | | PubKey htlcBasepoint, LightningMoney htlcMinimumAmount, ushort maxAcceptedHtlcs, |
| 20 | 18 | | LightningMoney maxHtlcValueInFlight, uint minimumDepth, PubKey paymentBasepoint, |
| 20 | 19 | | PubKey revocationBasepoint, ChannelId temporaryChannelId, ushort toSelfDelay) |
| | 20 | | : IMessagePayload |
| | 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> |
| 36 | 26 | | public ChannelId TemporaryChannelId { get; } = temporaryChannelId; |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// funding_satoshis is the amount the acceptor is putting into the channel. |
| | 30 | | /// </summary> |
| 36 | 31 | | public LightningMoney FundingAmount { get; } = fundingAmount; |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// dust_limit_satoshis is the threshold below which outputs should not be generated for this node's commitment or |
| | 35 | | /// HTLC transactions |
| | 36 | | /// </summary> |
| 36 | 37 | | public LightningMoney DustLimitAmount { get; } = dustLimitAmount; |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// max_htlc_value_in_flight_msat is a cap on total value of outstanding HTLCs offered by the remote node, which |
| | 41 | | /// allows the local node to limit its exposure to HTLCs |
| | 42 | | /// </summary> |
| 36 | 43 | | public LightningMoney MaxHtlcValueInFlightAmount { get; } = maxHtlcValueInFlight; |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// htlc_minimum_msat indicates the smallest value HTLC this node will accept. |
| | 47 | | /// </summary> |
| 36 | 48 | | public LightningMoney HtlcMinimumAmount { get; } = htlcMinimumAmount; |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// minimum_depth is the number of blocks we consider reasonable to avoid double-spending of the funding transaction |
| | 52 | | /// In case channel_type includes option_zeroconf this MUST be 0 |
| | 53 | | /// </summary> |
| 36 | 54 | | public uint MinimumDepth { get; } = minimumDepth; |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// to_self_delay is how long (in blocks) the other node will have to wait in case of breakdown before redeeming |
| | 58 | | /// its own funds. |
| | 59 | | /// </summary> |
| 36 | 60 | | public ushort ToSelfDelay { get; } = toSelfDelay; |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// max_accepted_htlcs limits the number of outstanding HTLCs the remote node can offer. |
| | 64 | | /// </summary> |
| 36 | 65 | | public ushort MaxAcceptedHtlcs { get; } = maxAcceptedHtlcs; |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// funding_pubkey is the public key in the 2-of-2 multisig script of the funding transaction output. |
| | 69 | | /// </summary> |
| 36 | 70 | | public PubKey FundingPubKey { get; } = fundingPubKey; |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// revocation_basepoint is used to regenerate the scripts required for the penalty transaction |
| | 74 | | /// </summary> |
| 36 | 75 | | public PubKey RevocationBasepoint { get; } = revocationBasepoint; |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// payment_basepoint is used to produce payment signatures for the protocol |
| | 79 | | /// </summary> |
| 36 | 80 | | public PubKey PaymentBasepoint { get; } = paymentBasepoint; |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// delayed_payment_basepoint is used to regenerate the scripts required for the penalty transaction |
| | 84 | | /// </summary> |
| 36 | 85 | | public PubKey DelayedPaymentBasepoint { get; } = delayedPaymentBasepoint; |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// htlc_basepoint is used to produce HTLC signatures for the protocol |
| | 89 | | /// </summary> |
| 36 | 90 | | public PubKey HtlcBasepoint { get; } = htlcBasepoint; |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// first_per_commitment_point is the per-commitment point used for the first commitment transaction |
| | 94 | | /// </summary> |
| 36 | 95 | | public PubKey FirstPerCommitmentPoint { get; } = firstPerCommitmentPoint; |
| | 96 | | } |