| | | 1 | | namespace NLightning.Domain.Channels.Validators.Parameters; |
| | | 2 | | |
| | | 3 | | using Money; |
| | | 4 | | using Protocol.Payloads; |
| | | 5 | | using Protocol.ValueObjects; |
| | | 6 | | |
| | | 7 | | public sealed class ChannelOpenOptionalValidationParameters |
| | | 8 | | { |
| | 0 | 9 | | public ChainHash? ChainHash { get; init; } |
| | 0 | 10 | | public LightningMoney? FundingAmount { get; init; } |
| | 0 | 11 | | public LightningMoney? PushAmount { get; init; } |
| | 0 | 12 | | public required LightningMoney HtlcMinimumAmount { get; init; } |
| | 0 | 13 | | public LightningMoney? MaxHtlcValueInFlight { get; init; } |
| | 0 | 14 | | public required LightningMoney ChannelReserveAmount { get; init; } |
| | 0 | 15 | | public required LightningMoney OurChannelReserveAmount { get; init; } |
| | 0 | 16 | | public required ushort MaxAcceptedHtlcs { get; init; } |
| | 0 | 17 | | public required LightningMoney DustLimitAmount { get; init; } |
| | 0 | 18 | | public required ushort ToSelfDelay { get; init; } |
| | 0 | 19 | | public LightningMoney? FeeRatePerKw { get; init; } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Creates validation parameters from an incoming OpenChannel1Payload. |
| | | 23 | | /// </summary> |
| | | 24 | | public static ChannelOpenOptionalValidationParameters FromOpenChannel1Payload( |
| | | 25 | | OpenChannel1Payload payload, LightningMoney ourChannelReserveAmount) |
| | | 26 | | { |
| | 0 | 27 | | return new ChannelOpenOptionalValidationParameters |
| | 0 | 28 | | { |
| | 0 | 29 | | ChainHash = payload.ChainHash, |
| | 0 | 30 | | FundingAmount = payload.FundingAmount, |
| | 0 | 31 | | PushAmount = payload.PushAmount, |
| | 0 | 32 | | HtlcMinimumAmount = payload.HtlcMinimumAmount, |
| | 0 | 33 | | MaxHtlcValueInFlight = payload.MaxHtlcValueInFlight, |
| | 0 | 34 | | ChannelReserveAmount = payload.ChannelReserveAmount, |
| | 0 | 35 | | OurChannelReserveAmount = ourChannelReserveAmount, |
| | 0 | 36 | | MaxAcceptedHtlcs = payload.MaxAcceptedHtlcs, |
| | 0 | 37 | | DustLimitAmount = payload.DustLimitAmount, |
| | 0 | 38 | | ToSelfDelay = payload.ToSelfDelay, |
| | 0 | 39 | | FeeRatePerKw = payload.FeeRatePerKw |
| | 0 | 40 | | }; |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | public static ChannelOpenOptionalValidationParameters FromAcceptChannel1Payload( |
| | | 44 | | AcceptChannel1Payload payload, LightningMoney ourChannelReserveAmount) |
| | | 45 | | { |
| | 0 | 46 | | return new ChannelOpenOptionalValidationParameters |
| | 0 | 47 | | { |
| | 0 | 48 | | HtlcMinimumAmount = payload.HtlcMinimumAmount, |
| | 0 | 49 | | ChannelReserveAmount = payload.ChannelReserveAmount, |
| | 0 | 50 | | OurChannelReserveAmount = ourChannelReserveAmount, |
| | 0 | 51 | | MaxAcceptedHtlcs = payload.MaxAcceptedHtlcs, |
| | 0 | 52 | | DustLimitAmount = payload.DustLimitAmount, |
| | 0 | 53 | | ToSelfDelay = payload.ToSelfDelay |
| | 0 | 54 | | }; |
| | | 55 | | } |
| | | 56 | | } |