< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Persistence.Entities.Channel.HtlcEntity
Assembly: NLightning.Infrastructure.Persistence
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Persistence/Entities/Channel/HtlcEntity.cs
Tag: 36_15743069263
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 108
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ChannelId()100%210%
get_HtlcId()100%210%
get_Direction()100%210%
get_AmountMsat()100%210%
get_PaymentHash()100%210%
get_PaymentPreimage()100%210%
get_CltvExpiry()100%210%
get_State()100%210%
get_ObscuredCommitmentNumber()100%210%
get_AddMessageBytes()100%210%
get_Signature()100%210%
.ctor()100%210%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Persistence/Entities/Channel/HtlcEntity.cs

#LineLine coverage
 1// ReSharper disable PropertyCanBeMadeInitOnly.Global
 2
 3using NLightning.Domain.Channels.ValueObjects;
 4
 5namespace NLightning.Infrastructure.Persistence.Entities.Channel;
 6
 7public class HtlcEntity
 8{
 9    /// <summary>
 10    /// Represents the unique identifier for a channel associated with the HTLC entity.
 11    /// This property is used to establish a relationship between HTLCs and their respective channels.
 12    /// </summary>
 13    /// <remarks>This is part of the composite-key identifier</remarks>
 014    public required ChannelId ChannelId { get; set; }
 15
 16    /// <summary>
 17    /// Represents the unique identifier for a specific HTLC (Hashed Time-Locked Contract) instance.
 18    /// This property helps to distinguish and track individual HTLCs associated with a channel.
 19    /// </summary>
 20    /// <remarks>This is part of the composite-key identifier</remarks>
 021    public required ulong HtlcId { get; set; }
 22
 23    /// <summary>
 24    /// Specifies the direction of the HTLC in relation to the channel, indicating whether it is incoming or outgoing.
 25    /// This property aids in identifying the flow of funds and the associated logic within the channel operations.
 26    /// </summary>
 27    /// <remarks>This is part of the composite-key identifier</remarks>
 028    public required byte Direction { get; set; }
 29
 30    /// <summary>
 31    /// Represents the amount associated with the HTLC in milli-satoshis (msat).
 32    /// This property is used to define the precise value of the HTLC for transactions and operations
 33    /// within the Lightning Network.
 34    /// </summary>
 035    public required ulong AmountMsat { get; set; }
 36
 37    /// <summary>
 38    /// Represents the hash identifier used for payment routing in Lightning Network.
 39    /// This property ensures that payments are routed securely without exposing the preimage.
 40    /// </summary>
 41    /// <remarks>
 42    /// The PaymentHash is a fundamental part of HTLC (Hashed Time Lock Contract) mechanics,
 43    /// allowing validation of payment claims through hash preimage revelation.
 44    /// </remarks>
 045    public required byte[] PaymentHash { get; set; } // uint256 as string
 46
 47    /// <summary>
 48    /// Represents the raw preimage of a cryptographic hash used in the context of
 49    /// HTLC (Hashed Time Lock Contract) payments.
 50    /// This property is utilized to verify payment authenticity by reconstructing the hash associated with the HTLC.
 51    /// </summary>
 52    /// <remarks>This property may be null if the preimage is not available at the given
 53    /// state of the HTLC lifecycle.</remarks>
 054    public byte[]? PaymentPreimage { get; set; } // uint256 as string, nullable
 55
 56    /// <summary>
 57    /// Represents the expiration time of the HTLC (Hashed Timelock Contract).
 58    /// This property indicates the deadline by which the HTLC must be resolved, or it becomes invalid.
 59    /// </summary>
 60    /// <remarks>This property is critical in ensuring the timely processing of payment channels to avoid stale or
 61    /// unresolved contracts.</remarks>
 062    public required uint CltvExpiry { get; set; } // Block height
 63
 64    /// <summary>
 65    /// Represents the current state of the HTLC (Hashed Time-Locked Contract).
 66    /// This property captures the lifecycle stage of the HTLC, such as being offered,
 67    /// settled, failed, fulfilled, or revoked.
 68    /// </summary>
 69    /// <remarks>
 70    /// The state is stored as an enumeration of type <see cref="NLightning.Domain.Channels.Enums.HtlcState"/>.
 71    /// </remarks>
 072    public required byte State { get; set; }
 73
 74    /// <summary>
 75    /// Represents the obscured commitment number associated with the HTLC entity.
 76    /// This property is used in creating a commitment transaction's unique identifier
 77    /// and ensures privacy and obfuscation in Lightning Network transactions.
 78    /// </summary>
 79    /// <remarks>
 80    /// The obscured commitment number is derived using the negotiated channel information
 81    /// and serves as a mechanism to mitigate channel state leakage.
 82    /// </remarks>
 083    public required ulong ObscuredCommitmentNumber { get; set; }
 84
 85    /// <summary>
 86    /// Stores the serialized byte representation of the HTLC's "Add" message.
 87    /// This property is used for persisting and reconstructing the HTLC's initial state for
 88    /// communication purposes.
 89    /// </summary>
 90    /// <remarks>
 91    /// This property facilitates the serialization and deserialization of the UpdateAddHtlcMessage
 92    /// to ensure accurate data storage and retrieval in the repository layers.
 93    /// </remarks>
 094    public required byte[] AddMessageBytes { get; set; }
 95
 96    /// <summary>
 97    /// Represents the cryptographic signature associated with the HTLC entity.
 98    /// This property is used to validate and ensure the authenticity of messages or transactions
 99    /// within the HTLC protocol, using the corresponding cryptographic keys.
 100    /// </summary>
 101    /// <remarks>This property is optional, as it may not be present in all scenarios.</remarks>
 0102    public byte[]? Signature { get; set; }
 103
 104    // Default constructor for EF Core
 0105    internal HtlcEntity()
 106    {
 0107    }
 108}