multi: fix linter errors

This commit is contained in:
Olaoluwa Osuntokun committed 2023-08-22 16:34:15 -07:00
1 parent d3e4bca772
commit a2b277cf1d
20 files changed
+187 -144

No files matched your search

+23 -5
View File
@@ -2513,8 +2513,8 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
// If our balance exceeds the remote party's dust limit, instantiate
// the sign descriptor for our output.
if ourAmt >= int64(chanState.RemoteChanCfg.DustLimit) {
// As we're about to sweep our own output w/o a delay, we'll obtain
// the witness script for the success/delay path.
// As we're about to sweep our own output w/o a delay, we'll
// obtain the witness script for the success/delay path.
witnessScript, err := ourScript.WitnessScriptForPath(
input.ScriptPathDelay,
)
@@ -2537,6 +2537,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
// spend (as our output on their revoked tx still needs the
// delay), and set the control block.
if scriptTree, ok := ourScript.(input.TapscriptDescriptor); ok {
//nolint:lll
br.LocalOutputSignDesc.SignMethod = input.TaprootScriptSpendSignMethod
ctrlBlock, err := scriptTree.CtrlBlockForPath(
@@ -2546,6 +2547,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
return nil, err
}
//nolint:lll
br.LocalOutputSignDesc.ControlBlock, err = ctrlBlock.ToBytes()
if err != nil {
return nil, err
@@ -2581,7 +2583,8 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
// For taproot channels, the remote output (the revoked output)
// is spent with a script path to ensure all information 3rd
// parties need to sweep anchors is revealed on chain.
if scriptTree, ok := theirScript.(input.TapscriptDescriptor); ok {
scriptTree, ok := theirScript.(input.TapscriptDescriptor)
if ok {
//nolint:lll
br.RemoteOutputSignDesc.SignMethod = input.TaprootScriptSpendSignMethod
@@ -2591,6 +2594,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
if err != nil {
return nil, err
}
//nolint:lll
br.RemoteOutputSignDesc.ControlBlock, err = ctrlBlock.ToBytes()
if err != nil {
return nil, err
@@ -6480,6 +6484,8 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, signer input.Si
// For taproot channels, we'll need to set some additional
// fields to ensure the output can be swept.
//
//nolint:lll
if scriptTree, ok := selfScript.(input.TapscriptDescriptor); ok {
commitResolution.SelfOutputSignDesc.SignMethod =
input.TaprootScriptSpendSignMethod
@@ -6490,6 +6496,7 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, signer input.Si
if err != nil {
return nil, err
}
//nolint:lll
commitResolution.SelfOutputSignDesc.ControlBlock, err = ctrlBlock.ToBytes()
if err != nil {
return nil, err
@@ -6836,6 +6843,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
return nil, err
}
} else {
//nolint:lll
secondLevelScriptTree, err := input.TaprootSecondLevelScriptTree(
keyRing.RevocationKey, keyRing.ToLocalKey, csvDelay,
)
@@ -6952,9 +6960,12 @@ func newIncomingHtlcResolution(signer input.Signer,
HashType: txscript.SigHashAll,
}
//nolint:lll
if scriptTree, ok := scriptInfo.(input.TapscriptDescriptor); ok {
signDesc.SignMethod = input.TaprootScriptSpendSignMethod
ctrlBlock, err := scriptTree.CtrlBlockForPath(scriptPath)
ctrlBlock, err := scriptTree.CtrlBlockForPath(
scriptPath,
)
if err != nil {
return nil, err
}
@@ -6979,7 +6990,8 @@ func newIncomingHtlcResolution(signer input.Signer,
secondLevelOutputAmt := htlc.Amt.ToSatoshis() - htlcFee
successTx, err := CreateHtlcSuccessTx(
chanType, isCommitFromInitiator, op, secondLevelOutputAmt,
csvDelay, leaseExpiry, keyRing.RevocationKey, keyRing.ToLocalKey,
csvDelay, leaseExpiry, keyRing.RevocationKey,
keyRing.ToLocalKey,
)
if err != nil {
return nil, err
@@ -7068,6 +7080,7 @@ func newIncomingHtlcResolution(signer input.Signer,
return nil, err
}
} else {
//nolint:lll
secondLevelScriptTree, err := input.TaprootSecondLevelScriptTree(
keyRing.RevocationKey, keyRing.ToLocalKey, csvDelay,
)
@@ -7429,6 +7442,7 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
if err != nil {
return nil, err
}
//nolint:lll
commitResolution.SelfOutputSignDesc.ControlBlock, err = ctrlBlock.ToBytes()
if err != nil {
return nil, err
@@ -7823,6 +7837,7 @@ func NewAnchorResolution(chanState *channeldb.OpenChannel,
return nil, err
}
if chanState.ChanType.IsTaproot() && !isLocalCommit {
//nolint:ineffassign
localAnchor, remoteAnchor = remoteAnchor, localAnchor
}
@@ -7868,6 +7883,7 @@ func NewAnchorResolution(chanState *channeldb.OpenChannel,
signDesc.SignMethod = input.TaprootKeySpendSignMethod
signDesc.HashType = txscript.SigHashDefault
//nolint:lll
signDesc.PrevOutputFetcher = txscript.NewCannedPrevOutputFetcher(
localAnchor.PkScript(), int64(anchorSize),
)
@@ -7888,6 +7904,8 @@ func NewAnchorResolution(chanState *channeldb.OpenChannel,
// When we're playing the force close of a remote
// commitment, as this is a "tweakless" channel type,
// we don't need a tweak value at all.
//
//nolint:lll
signDesc.KeyDesc = chanState.LocalChanCfg.PaymentBasePoint
}