multi: fix linter errors
This commit is contained in:
20 files changed
+187
-144
No files matched your search
+23
-5
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+13
-11
@@ -425,6 +425,9 @@ func SecondLevelHtlcScript(chanType channeldb.ChannelType, initiator bool,
|
||||
witnessScript, err := input.LeaseSecondLevelHtlcScript(
|
||||
revocationKey, delayKey, csvDelay, leaseExpiry,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pkScript, err := input.WitnessScriptHash(witnessScript)
|
||||
if err != nil {
|
||||
@@ -440,6 +443,9 @@ func SecondLevelHtlcScript(chanType channeldb.ChannelType, initiator bool,
|
||||
witnessScript, err := input.SecondLevelHtlcScript(
|
||||
revocationKey, delayKey, csvDelay,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pkScript, err := input.WitnessScriptHash(witnessScript)
|
||||
if err != nil {
|
||||
@@ -528,6 +534,7 @@ func CommitScriptAnchors(chanType channeldb.ChannelType,
|
||||
case chanType.IsTaproot():
|
||||
anchorScript = func(key *btcec.PublicKey,
|
||||
) (input.ScriptDescriptor, error) {
|
||||
|
||||
return input.NewAnchorScriptTree(
|
||||
key,
|
||||
)
|
||||
@@ -1096,9 +1103,6 @@ func genTaprootHtlcScript(isIncoming, ourCommit bool, timeout uint32,
|
||||
keyRing.LocalHtlcKey, keyRing.RemoteHtlcKey,
|
||||
keyRing.RevocationKey, rHash[:], ourCommit,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Finally, we're paying the remote party via an HTLC, which is being
|
||||
// added to their commitment transaction. Therefore, we use the
|
||||
@@ -1108,12 +1112,9 @@ func genTaprootHtlcScript(isIncoming, ourCommit bool, timeout uint32,
|
||||
timeout, keyRing.LocalHtlcKey, keyRing.RemoteHtlcKey,
|
||||
keyRing.RevocationKey, rHash[:], ourCommit,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return htlcScriptTree, nil
|
||||
return htlcScriptTree, err
|
||||
}
|
||||
|
||||
// genHtlcScript generates the proper P2WSH public key scripts for the HTLC
|
||||
@@ -1131,11 +1132,11 @@ func genHtlcScript(chanType channeldb.ChannelType, isIncoming, ourCommit bool,
|
||||
chanType, isIncoming, ourCommit, timeout, rHash,
|
||||
keyRing,
|
||||
)
|
||||
} else {
|
||||
return genTaprootHtlcScript(
|
||||
isIncoming, ourCommit, timeout, rHash, keyRing,
|
||||
)
|
||||
}
|
||||
|
||||
return genTaprootHtlcScript(
|
||||
isIncoming, ourCommit, timeout, rHash, keyRing,
|
||||
)
|
||||
}
|
||||
|
||||
// addHTLC adds a new HTLC to the passed commitment transaction. One of four
|
||||
@@ -1174,6 +1175,7 @@ func addHTLC(commitTx *wire.MsgTx, ourCommit bool,
|
||||
} else {
|
||||
paymentDesc.theirPkScript = pkScript
|
||||
|
||||
//nolint:lll
|
||||
paymentDesc.theirWitnessScript = scriptInfo.WitnessScriptToSign()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user