Skip to content

Commit

Permalink
multi: fix linter warnings with updated linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Aug 22, 2023
1 parent 7506383 commit 92da6b1
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 26 deletions.
1 change: 0 additions & 1 deletion contractcourt/htlc_timeout_resolver.go
Expand Up @@ -444,7 +444,6 @@ func (h *htlcTimeoutResolver) sweepSecondLevelTx() error {

var inp input.Input
if h.isTaproot() {
//nolint:lll
inp = lnutils.Ptr(input.MakeHtlcSecondLevelTimeoutTaprootInput(
h.htlcResolution.SignedTimeoutTx,
h.htlcResolution.SignDetails,
Expand Down
16 changes: 8 additions & 8 deletions contractcourt/taproot_briefcase.go
Expand Up @@ -159,7 +159,7 @@ func (r *resolverCtrlBlocks) Decode(reader io.Reader) error {

// resolverCtrlBlocksEncoder is a custom TLV encoder for the
// resolverCtrlBlocks.
func resolverCtrlBlocksEncoder(w io.Writer, val any, buf *[8]byte) error {
func resolverCtrlBlocksEncoder(w io.Writer, val any, _ *[8]byte) error {
if typ, ok := val.(*resolverCtrlBlocks); ok {
return (*typ).Encode(w)
}
Expand All @@ -168,7 +168,7 @@ func resolverCtrlBlocksEncoder(w io.Writer, val any, buf *[8]byte) error {
}

// rsolverCtrlBlocksDecoder is a custom TLV decoder for the resolverCtrlBlocks.
func resolverCtrlBlocksDecoder(r io.Reader, val any, buf *[8]byte,
func resolverCtrlBlocksDecoder(r io.Reader, val any, _ *[8]byte,
l uint64) error {

if typ, ok := val.(*resolverCtrlBlocks); ok {
Expand Down Expand Up @@ -259,7 +259,7 @@ func varBytesDecoder(r io.Reader, val any, buf *[8]byte, l uint64) error {
}

// ctrlBlockEncoder is a custom TLV encoder for the ctrlBlocks struct.
func ctrlBlockEncoder(w io.Writer, val any, buf *[8]byte) error {
func ctrlBlockEncoder(w io.Writer, val any, _ *[8]byte) error {
if t, ok := val.(**ctrlBlocks); ok {
return (*t).Encode(w)
}
Expand All @@ -268,7 +268,7 @@ func ctrlBlockEncoder(w io.Writer, val any, buf *[8]byte) error {
}

// ctrlBlockDecoder is a custom TLV decoder for the ctrlBlocks struct.
func ctrlBlockDecoder(r io.Reader, val any, buf *[8]byte, l uint64) error {
func ctrlBlockDecoder(r io.Reader, val any, _ *[8]byte, l uint64) error {
if typ, ok := val.(**ctrlBlocks); ok {
ctrlReader := io.LimitReader(r, int64(l))

Expand Down Expand Up @@ -458,7 +458,7 @@ func (h *htlcTapTweaks) Encode(w io.Writer) error {
}

// htlcTapTweaksEncoder is a custom TLV encoder for the htlcTapTweaks struct.
func htlcTapTweaksEncoder(w io.Writer, val any, buf *[8]byte) error {
func htlcTapTweaksEncoder(w io.Writer, val any, _ *[8]byte) error {
if t, ok := val.(*htlcTapTweaks); ok {
return (*t).Encode(w)
}
Expand All @@ -467,7 +467,7 @@ func htlcTapTweaksEncoder(w io.Writer, val any, buf *[8]byte) error {
}

// htlcTapTweaksDecoder is a custom TLV decoder for the htlcTapTweaks struct.
func htlcTapTweaksDecoder(r io.Reader, val any, buf *[8]byte,
func htlcTapTweaksDecoder(r io.Reader, val any, _ *[8]byte,
l uint64) error {

if typ, ok := val.(*htlcTapTweaks); ok {
Expand Down Expand Up @@ -538,7 +538,7 @@ func newTapTweaks() *tapTweaks {
}

// tapTweaksEncoder is a custom TLV encoder for the tapTweaks struct.
func tapTweaksEncoder(w io.Writer, val any, buf *[8]byte) error {
func tapTweaksEncoder(w io.Writer, val any, _ *[8]byte) error {
if t, ok := val.(**tapTweaks); ok {
return (*t).Encode(w)
}
Expand All @@ -547,7 +547,7 @@ func tapTweaksEncoder(w io.Writer, val any, buf *[8]byte) error {
}

// tapTweaksDecoder is a custom TLV decoder for the tapTweaks struct.
func tapTweaksDecoder(r io.Reader, val any, buf *[8]byte, l uint64) error {
func tapTweaksDecoder(r io.Reader, val any, _ *[8]byte, l uint64) error {
if typ, ok := val.(**tapTweaks); ok {
tweakReader := io.LimitReader(r, int64(l))

Expand Down
3 changes: 2 additions & 1 deletion funding/manager.go
Expand Up @@ -1528,6 +1528,7 @@ func (f *Manager) handleFundingOpen(peer lnpeer.Peer,
"channel")
log.Error(err)
f.failFundingFlow(peer, cid, err)

return

// The current variant of taproot channels can only be used with
Expand Down Expand Up @@ -3646,7 +3647,7 @@ func genFirstStateMusigNonce(channel *channeldb.OpenChannel,

// handleChannelReady finalizes the channel funding process and enables the
// channel to enter normal operating mode.
func (f *Manager) handleChannelReady(peer lnpeer.Peer,
func (f *Manager) handleChannelReady(peer lnpeer.Peer, //nolint:funlen
msg *lnwire.ChannelReady) {

defer f.wg.Done()
Expand Down
2 changes: 1 addition & 1 deletion input/musig2.go
Expand Up @@ -432,7 +432,7 @@ func createContextV100RC2(privKey *btcec.PrivateKey,
// draft version 0.4.0.
func createContextV040(privKey *btcec.PrivateKey,
allSignerPubKeys []*btcec.PublicKey, tweaks *MuSig2Tweaks,
sessionOpts ...musig2.SessionOption,
_ ...musig2.SessionOption,
) (*musig2v040.Context, *musig2v040.Session, error) {

// The context keeps track of all signing keys and our local key.
Expand Down
9 changes: 2 additions & 7 deletions itest/lnd_funding_test.go
Expand Up @@ -142,7 +142,7 @@ func testBasicChannelFunding(ht *lntest.HarnessTest) {
chansCommitType == lnrpc.CommitmentType_ANCHORS:

case expType == lnrpc.CommitmentType_STATIC_REMOTE_KEY &&
chansCommitType == lnrpc.CommitmentType_STATIC_REMOTE_KEY:
chansCommitType == lnrpc.CommitmentType_STATIC_REMOTE_KEY: //nolint:lll

case expType == lnrpc.CommitmentType_LEGACY &&
chansCommitType == lnrpc.CommitmentType_LEGACY:
Expand Down Expand Up @@ -221,7 +221,7 @@ func basicChannelFundingTest(ht *lntest.HarnessTest,
)

// Deprecated fields.
newResp.Balance += int64(local) // nolint:staticcheck
newResp.Balance += int64(local)
ht.AssertChannelBalanceResp(node, newResp)
}

Expand Down Expand Up @@ -393,11 +393,6 @@ func testUnconfirmedChannelFunding(ht *lntest.HarnessTest) {
// testChannelFundingInputTypes tests that any type of supported input type can
// be used to fund channels.
func testChannelFundingInputTypes(ht *lntest.HarnessTest) {
const (
chanAmt = funding.MaxBtcFundingAmount
burnAddr = "bcrt1qxsnqpdc842lu8c0xlllgvejt6rhy49u6fmpgyz"
)

// We'll start off by creating a node for Carol.
carol := ht.NewNode("Carol", nil)

Expand Down
2 changes: 1 addition & 1 deletion lnwallet/commitment.go
Expand Up @@ -211,7 +211,7 @@ func (w *WitnessScriptDesc) WitnessScriptToSign() []byte {
// An error is returned if the path is unknown. This is useful as when
// constructing a contrl block for a given path, one also needs witness script
// being signed.
func (w *WitnessScriptDesc) WitnessScriptForPath(path input.ScriptPath,
func (w *WitnessScriptDesc) WitnessScriptForPath(_ input.ScriptPath,
) ([]byte, error) {

return w.WitnessScript, nil
Expand Down
4 changes: 3 additions & 1 deletion lnwallet/rpcwallet/rpcwallet.go
Expand Up @@ -657,13 +657,15 @@ func (r *RPCKeyRing) ComputeInputScript(tx *wire.MsgTx,
func (r *RPCKeyRing) MuSig2CreateSession(bipVersion input.MuSig2Version,
keyLoc keychain.KeyLocator, pubKeys []*btcec.PublicKey,
tweaks *input.MuSig2Tweaks, otherNonces [][musig2.PubNonceSize]byte,
sessionOpts ...musig2.SessionOption) (*input.MuSig2SessionInfo, error) {
_ ...musig2.SessionOption) (*input.MuSig2SessionInfo, error) {

apiVersion, err := signrpc.MarshalMuSig2Version(bipVersion)
if err != nil {
return nil, err
}

// TODO(roasbeef): add protos to specify session options

// We need to serialize all data for the RPC call. We can do that by
// putting everything directly into the request struct.
req := &signrpc.MuSig2SessionRequest{
Expand Down
4 changes: 2 additions & 2 deletions lnwire/musig2.go
Expand Up @@ -26,7 +26,7 @@ func (m *Musig2Nonce) Record() tlv.Record {
}

// nonceTypeEncoder is a custom TLV encoder for the Musig2Nonce type.
func nonceTypeEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
func nonceTypeEncoder(w io.Writer, val interface{}, _ *[8]byte) error {
if v, ok := val.(*Musig2Nonce); ok {
_, err := w.Write(v[:])
return err
Expand All @@ -36,7 +36,7 @@ func nonceTypeEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
}

// nonceTypeDecoder is a custom TLV decoder for the Musig2Nonce record.
func nonceTypeDecoder(r io.Reader, val interface{}, buf *[8]byte,
func nonceTypeDecoder(r io.Reader, val interface{}, _ *[8]byte,
l uint64) error {

if v, ok := val.(*Musig2Nonce); ok {
Expand Down
2 changes: 1 addition & 1 deletion lnwire/partial_sig.go
Expand Up @@ -137,7 +137,7 @@ func (p *PartialSigWithNonce) Record() tlv.Record {
// partialSigWithNonceTypeEncoder encodes 98-byte musig2 extended partial
// signature as: s {32} || nonce {66}.
func partialSigWithNonceTypeEncoder(w io.Writer, val interface{},
buf *[8]byte) error {
_ *[8]byte) error {

if v, ok := val.(*PartialSigWithNonce); ok {
sigBytes := v.Sig.Bytes()
Expand Down
4 changes: 2 additions & 2 deletions lnwire/shutdown.go
Expand Up @@ -29,7 +29,7 @@ func (s *ShutdownNonce) Record() tlv.Record {

// shutdownNonceTypeEncoder is a custom TLV encoder for the Musig2Nonce type.
func shutdownNonceTypeEncoder(w io.Writer, val interface{},
buf *[8]byte) error {
_ *[8]byte) error {

if v, ok := val.(*ShutdownNonce); ok {
_, err := w.Write(v[:])
Expand All @@ -40,7 +40,7 @@ func shutdownNonceTypeEncoder(w io.Writer, val interface{},
}

// shutdownNonceTypeDecoder is a custom TLV decoder for the Musig2Nonce record.
func shutdownNonceTypeDecoder(r io.Reader, val interface{}, buf *[8]byte,
func shutdownNonceTypeDecoder(r io.Reader, val interface{}, _ *[8]byte,
l uint64) error {

if v, ok := val.(*ShutdownNonce); ok {
Expand Down
2 changes: 1 addition & 1 deletion sample-lnd.conf
Expand Up @@ -1462,7 +1462,7 @@


; Set to enable support for the experimental taproot channel type.
; protocol.simple-taproot-chans
; protocol.simple-taproot-chans=false

[db]

Expand Down

0 comments on commit 92da6b1

Please sign in to comment.