< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Bitcoin.Outputs.FundingOutput
Assembly: NLightning.Infrastructure.Bitcoin
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Bitcoin/Outputs/FundingOutput.cs
Tag: 36_15743069263
Line coverage
76%
Covered lines: 13
Uncovered lines: 4
Coverable lines: 17
Total lines: 38
Line coverage: 76.4%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ScriptType()100%11100%
get_LocalPubKey()100%210%
get_RemotePubKey()100%210%
.ctor(...)50%4.13480%
CreateMultisigScript(...)100%11100%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Bitcoin/Outputs/FundingOutput.cs

#LineLine coverage
 1using NBitcoin;
 2
 3namespace NLightning.Infrastructure.Bitcoin.Outputs;
 4
 5using Domain.Money;
 6
 7public class FundingOutput : BaseOutput
 8{
 1329    public override ScriptType ScriptType => ScriptType.P2WSH;
 10
 011    public PubKey LocalPubKey { get; }
 012    public PubKey RemotePubKey { get; }
 13
 14    public FundingOutput(LightningMoney amount, PubKey localPubKey, PubKey remotePubKey)
 13215        : base(amount, CreateMultisigScript(localPubKey, remotePubKey))
 16    {
 13217        ArgumentNullException.ThrowIfNull(localPubKey);
 13218        ArgumentNullException.ThrowIfNull(remotePubKey);
 19
 13220        if (localPubKey == remotePubKey)
 021            throw new ArgumentException("Public keys must be different.");
 22
 13223        if (amount.IsZero)
 024            throw new ArgumentOutOfRangeException(nameof(amount), "Funding amount must be greater than zero.");
 25
 13226        LocalPubKey = localPubKey;
 13227        RemotePubKey = remotePubKey;
 13228    }
 29
 30    private static Script CreateMultisigScript(PubKey localPubKey, PubKey remotePubKey)
 31    {
 13232        ArgumentNullException.ThrowIfNull(localPubKey);
 13233        ArgumentNullException.ThrowIfNull(remotePubKey);
 34
 39635        var orderedKeys = new[] { localPubKey, remotePubKey }.OrderBy(pk => pk, PubKeyComparer.Instance).ToArray();
 13236        return PayToMultiSigTemplate.Instance.GenerateScriptPubKey(2, orderedKeys);
 37    }
 38}