| | 1 | | // ReSharper disable PropertyCanBeMadeInitOnly.Global |
| | 2 | |
|
| | 3 | | using NLightning.Domain.Channels.ValueObjects; |
| | 4 | |
|
| | 5 | | namespace NLightning.Infrastructure.Persistence.Entities.Channel; |
| | 6 | |
|
| | 7 | | /// <summary> |
| | 8 | | /// Represents a set of cryptographic keys associated with a Lightning Network channel. |
| | 9 | | /// </summary> |
| | 10 | | public class ChannelKeySetEntity |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// The unique channel identifier this key set belongs to. |
| | 14 | | /// </summary> |
| | 15 | | /// <remarks>Part of the composite primary key.</remarks> |
| 0 | 16 | | public required ChannelId ChannelId { get; set; } |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// Indicates whether this key set belongs to the local node or remote node. |
| | 20 | | /// </summary> |
| | 21 | | /// <remarks>Part of the composite primary key.</remarks> |
| 0 | 22 | | public bool IsLocal { get; set; } |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// The funding public key used to create the multisig funding output. |
| | 26 | | /// </summary> |
| 0 | 27 | | public required byte[] FundingPubKey { get; set; } |
| | 28 | |
|
| | 29 | | /// <summary> |
| | 30 | | /// The base point for generating revocation keys. |
| | 31 | | /// </summary> |
| 0 | 32 | | public required byte[] RevocationBasepoint { get; set; } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// The base point for generating payment keys. |
| | 36 | | /// </summary> |
| 0 | 37 | | public required byte[] PaymentBasepoint { get; set; } |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// The base point for generating delayed payment keys. |
| | 41 | | /// </summary> |
| 0 | 42 | | public required byte[] DelayedPaymentBasepoint { get; set; } |
| | 43 | |
|
| | 44 | | /// <summary> |
| | 45 | | /// The base point for generating HTLC keys. |
| | 46 | | /// </summary> |
| 0 | 47 | | public required byte[] HtlcBasepoint { get; set; } |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// The current per-commitment index used in a channel's key set. |
| | 51 | | /// </summary> |
| | 52 | | /// <remarks> |
| | 53 | | /// This index tracks the state of the commitment transaction sequence |
| | 54 | | /// in the channel. It is incremented with each new commitment point. |
| | 55 | | /// </remarks> |
| 0 | 56 | | public required ulong CurrentPerCommitmentIndex { get; set; } |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// The current per-commitment point being used for the active commitment transaction. |
| | 60 | | /// </summary> |
| 0 | 61 | | public required byte[] CurrentPerCommitmentPoint { get; set; } |
| | 62 | |
|
| | 63 | | /// <summary> |
| | 64 | | /// For remote key sets: stores their last revealed per-commitment secret |
| | 65 | | /// This is needed to create penalty transactions if they broadcast old commitments |
| | 66 | | /// For local key sets: this should be null (we don't store our own secrets) |
| | 67 | | /// </summary> |
| | 68 | |
|
| 0 | 69 | | public byte[]? LastRevealedPerCommitmentSecret { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// The index representing the key derivation progress for this channel key set. |
| | 73 | | /// </summary> |
| | 74 | | /// <remarks>Used to track the current state of key generation in the channel.</remarks> |
| 0 | 75 | | public required uint KeyIndex { get; set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Default constructor for EF Core. |
| | 79 | | /// </summary> |
| 0 | 80 | | internal ChannelKeySetEntity() |
| | 81 | | { |
| 0 | 82 | | } |
| | 83 | | } |