< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Channels.ValueObjects.CommitmentKeys
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Channels/ValueObjects/CommitmentKeys.cs
Tag: 36_15743069263
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 66
Line coverage: 100%
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_LocalPubKey()100%11100%
get_LocalDelayedPubKey()100%11100%
get_RevocationPubKey()100%11100%
get_LocalHtlcPubKey()100%11100%
get_RemoteHtlcPubKey()100%11100%
get_PerCommitmentPoint()100%11100%
get_PerCommitmentSecret()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/Channels/ValueObjects/CommitmentKeys.cs

#LineLine coverage
 1namespace NLightning.Domain.Channels.ValueObjects;
 2
 3using NLightning.Domain.Crypto.ValueObjects;
 4
 5public record struct CommitmentKeys
 6{
 7    /// <summary>
 8    /// The localpubkey from the commitment owner's perspective.
 9    /// Derived as: payment_basepoint + SHA256(per_commitment_point || payment_basepoint) * G
 10    /// Used for to_remote outputs (the other party can spend immediately).
 11    /// </summary>
 6412    public CompactPubKey LocalPubKey { get; init; }
 13
 14    /// <summary>
 15    /// The local_delayedpubkey from the commitment owner's perspective.
 16    /// Derived as: delayed_payment_basepoint + SHA256(per_commitment_point || delayed_payment_basepoint) * G
 17    /// Used for to_local outputs (the commitment owner can spend after a delay).
 18    /// </summary>
 12419    public CompactPubKey LocalDelayedPubKey { get; init; }
 20
 21    /// <summary>
 22    /// The revocationpubkey that allows the other party to revoke this commitment.
 23    /// Complex derivation involving both parties' keys to ensure neither can compute the private key alone.
 24    /// </summary>
 25625    public CompactPubKey RevocationPubKey { get; init; }
 26
 27    /// <summary>
 28    /// The local_htlcpubkey from the commitment owner's perspective.
 29    /// Derived as: htlc_basepoint + SHA256(per_commitment_point || htlc_basepoint) * G
 30    /// Used for HTLC outputs owned by the commitment owner.
 31    /// </summary>
 19632    public CompactPubKey LocalHtlcPubKey { get; init; }
 33
 34    /// <summary>
 35    /// The remote_htlcpubkey from the commitment owner's perspective.
 36    /// Derived as: remote_htlc_basepoint + SHA256(per_commitment_point || remote_htlc_basepoint) * G
 37    /// Used for HTLC outputs owned by the other party.
 38    /// </summary>
 19639    public CompactPubKey RemoteHtlcPubKey { get; init; }
 40
 41    /// <summary>
 42    /// The per-commitment point used to derive all the above keys.
 43    /// Generated as: per_commitment_secret * G
 44    /// </summary>
 6445    public CompactPubKey PerCommitmentPoint { get; init; }
 46
 47    /// <summary>
 48    /// The per-commitment secret used to generate the per-commitment point.
 49    /// Only available for our own commitments, not for remote commitments.
 50    /// </summary>
 6451    public Secret? PerCommitmentSecret { get; init; }
 52
 53    public CommitmentKeys(CompactPubKey localPubKey, CompactPubKey localDelayedPubKey,
 54                          CompactPubKey revocationPubKey, CompactPubKey localHtlcPubKey,
 55                          CompactPubKey remoteHtlcPubKey, CompactPubKey perCommitmentPoint,
 56                          Secret? perCommitmentSecret)
 57    {
 6458        LocalPubKey = localPubKey;
 6459        LocalDelayedPubKey = localDelayedPubKey;
 6460        RevocationPubKey = revocationPubKey;
 6461        LocalHtlcPubKey = localHtlcPubKey;
 6462        RemoteHtlcPubKey = remoteHtlcPubKey;
 6463        PerCommitmentPoint = perCommitmentPoint;
 6464        PerCommitmentSecret = perCommitmentSecret;
 6465    }
 66}