lint: fix wastedassign issues in non-test files
What changed, and why it matters
This commit removes unused variable assignments that were flagged by a Go linter. In two command-line handlers, it stops advancing an argument list that is never read again. In a Lightning channel function, it simplifies a swap to only assign the value that is actually used. There is no visible security relevance: no behavior changes, no bug fixes, and no disclosed vulnerability.
No security action needed. Treat as routine code-quality/maintenance cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch addresses ‘wastedassign’ linter warnings. In cmd/commands/commands.go and cmd/commands/walletrpc_active.go, args = args.Tail() is removed because args is not referenced afterward. In lnwallet/channel.go, the previous localAnchor, remoteAnchor = remoteAnchor, localAnchor swap is replaced with localAnchor = remoteAnchor because only localAnchor is used subsequently. These are dead-store cleanups with no functional effect.
Changed components
cmd/commands/commands.gocmd/commands/walletrpc_active.golnwallet/channel.goInspect captured patch +1 / −5
diff --git a/cmd/commands/commands.go b/cmd/commands/commands.go
index 0c389a6..8bf75a2 100644
--- a/cmd/commands/commands.go
+++ b/cmd/commands/commands.go
@@ -769,7 +769,6 @@ func listUnspent(ctx *cli.Context) error {
cli.ShowCommandHelp(ctx, "listunspent")
return nil
}
- args = args.Tail()
}
unconfirmedOnly := ctx.Bool("unconfirmed_only")
diff --git a/cmd/commands/walletrpc_active.go b/cmd/commands/walletrpc_active.go
index dcb91a7..99f8982 100644
--- a/cmd/commands/walletrpc_active.go
+++ b/cmd/commands/walletrpc_active.go
@@ -2013,7 +2013,6 @@ func signMessageWithAddr(ctx *cli.Context) error {
case ctx.Args().Present():
msg = []byte(args.First())
- args = args.Tail()
default:
return fmt.Errorf("msg argument missing")
@@ -2121,7 +2120,6 @@ func verifyMessageWithAddr(ctx *cli.Context) error {
case ctx.Args().Present():
msg = []byte(args.First())
- args = args.Tail()
default:
return fmt.Errorf("msg argument missing")
diff --git a/lnwallet/channel.go b/lnwallet/channel.go
index b4966d3..e60ebb6 100644
--- a/lnwallet/channel.go
+++ b/lnwallet/channel.go
@@ -9059,8 +9059,7 @@ func NewAnchorResolution(chanState *channeldb.OpenChannel,
return nil, err
}
if chanState.ChanType.IsTaproot() && whoseCommit.IsRemote() {
- //nolint:ineffassign
- localAnchor, remoteAnchor = remoteAnchor, localAnchor
+ localAnchor = remoteAnchor
}
// TODO(roasbeef): remote anchor not needed above
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.