< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Factories.ChannelIdFactory
Assembly: NLightning.Infrastructure
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Factories/ChannelIdFactory.cs
Tag: 30_15166811759
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 25
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
CreateV2(...)100%44100%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Factories/ChannelIdFactory.cs

#LineLine coverage
 1namespace NLightning.Infrastructure.Factories;
 2
 3using Crypto.Hashes;
 4using Domain.ValueObjects;
 5
 6public static class ChannelIdFactory
 7{
 8    public static ChannelId CreateV2(Span<byte> lesserRevocationBasepoint, Span<byte> greaterRevocationBasepoint)
 9    {
 1210        if (lesserRevocationBasepoint.Length != 33 || greaterRevocationBasepoint.Length != 33)
 11        {
 812            throw new ArgumentException("Revocation basepoints must be 33 bytes each");
 13        }
 14
 415        Span<byte> combined = stackalloc byte[66];
 416        lesserRevocationBasepoint.CopyTo(combined);
 417        greaterRevocationBasepoint.CopyTo(combined[33..]);
 18
 419        using var hasher = new Sha256();
 420        hasher.AppendData(combined);
 421        Span<byte> hash = stackalloc byte[32];
 422        hasher.GetHashAndReset(hash);
 423        return new ChannelId(hash);
 424    }
 25}