< 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: 30_15166811759
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 38
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
get_ScriptType()100%11100%
get_LocalPubKey()100%11100%
get_RemotePubKey()100%11100%
.ctor(...)100%44100%
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{
 2969    public override ScriptType ScriptType => ScriptType.P2WSH;
 10
 5611    public PubKey LocalPubKey { get; }
 15612    public PubKey RemotePubKey { get; }
 13
 14    public FundingOutput(PubKey localPubKey, PubKey remotePubKey, LightningMoney amount)
 29215        : base(CreateMultisigScript(localPubKey, remotePubKey), amount)
 16    {
 29217        ArgumentNullException.ThrowIfNull(localPubKey);
 29218        ArgumentNullException.ThrowIfNull(remotePubKey);
 19
 29220        if (localPubKey == remotePubKey)
 421            throw new ArgumentException("Public keys must be different.");
 22
 28823        if (amount.IsZero)
 424            throw new ArgumentOutOfRangeException(nameof(amount), "Funding amount must be greater than zero.");
 25
 28426        LocalPubKey = localPubKey;
 28427        RemotePubKey = remotePubKey;
 28428    }
 29
 30    private static Script CreateMultisigScript(PubKey localPubKey, PubKey remotePubKey)
 31    {
 29232        ArgumentNullException.ThrowIfNull(localPubKey);
 29233        ArgumentNullException.ThrowIfNull(remotePubKey);
 34
 87635        var orderedKeys = new[] { localPubKey, remotePubKey }.OrderBy(pk => pk, PubKeyComparer.Instance).ToArray();
 29236        return PayToMultiSigTemplate.Instance.GenerateScriptPubKey(2, orderedKeys);
 37    }
 38}