multi: fix complaints from IDE and linter

Fixed unused param and nilness cond.
This commit is contained in:
yyforyongyu committed 2024-06-07 00:45:15 +08:00
1 parent a832371d61
commit 78cc1619d7
4 files changed
+11 -13

No files matched your search

+4 -4
View File
@@ -958,7 +958,7 @@ func initBreachedState(t *testing.T) (*BreachArbitrator,
// Create a pair of channels using a notifier that allows us to signal
// a spend of the funding transaction. Alice's channel will be the on
// observing a breach.
alice, bob, err := createInitChannels(t, 1)
alice, bob, err := createInitChannels(t)
require.NoError(t, err, "unable to create test channels")
// Instantiate a breach arbiter to handle the breach of alice's channel.
@@ -2150,7 +2150,7 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent,
// createInitChannels creates two initialized test channels funded with 10 BTC,
// with 5 BTC allocated to each side. Within the channel, Alice is the
// initiator.
func createInitChannels(t *testing.T, revocationWindow int) (
func createInitChannels(t *testing.T) (
*lnwallet.LightningChannel, *lnwallet.LightningChannel, error) {
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(
@@ -2395,7 +2395,7 @@ func createInitChannels(t *testing.T, revocationWindow int) (
// Now that the channel are open, simulate the start of a session by
// having Alice and Bob extend their revocation windows to each other.
err = initRevocationWindows(channelAlice, channelBob, revocationWindow)
err = initRevocationWindows(channelAlice, channelBob)
if err != nil {
return nil, nil, err
}
@@ -2408,7 +2408,7 @@ func createInitChannels(t *testing.T, revocationWindow int) (
// commitment state machines.
//
// TODO(conner) remove code duplication
func initRevocationWindows(chanA, chanB *lnwallet.LightningChannel, windowSize int) error {
func initRevocationWindows(chanA, chanB *lnwallet.LightningChannel) error {
aliceNextRevoke, err := chanA.NextRevocationKey()
if err != nil {
return err
+2 -4
View File
@@ -1188,7 +1188,7 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
// If this is a zero-conf channel, then we will wait
// for it to be confirmed before announcing it to the
// greater network.
err := f.waitForZeroConfChannel(channel, pendingChanID)
err := f.waitForZeroConfChannel(channel)
if err != nil {
return fmt.Errorf("failed waiting for zero "+
"channel: %v", err)
@@ -3605,9 +3605,7 @@ func (f *Manager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
// waitForZeroConfChannel is called when the state is addedToRouterGraph with
// a zero-conf channel. This will wait for the real confirmation, add the
// confirmed SCID to the router graph, and then announce after six confs.
func (f *Manager) waitForZeroConfChannel(c *channeldb.OpenChannel,
pendingID [32]byte) error {
func (f *Manager) waitForZeroConfChannel(c *channeldb.OpenChannel) error {
// First we'll check whether the channel is confirmed on-chain. If it
// is already confirmed, the chainntnfs subsystem will return with the
// confirmed tx. Otherwise, we'll wait here until confirmation occurs.
+2 -2
View File
@@ -1089,7 +1089,7 @@ func (p *Brontide) loadActiveChannels(chans []*channeldb.OpenChannel) (
return
}
shutdownMsg = fn.Some[lnwire.Shutdown](*shutdown)
shutdownMsg = fn.Some(*shutdown)
})
if shutdownInfoErr != nil {
return nil, shutdownInfoErr
@@ -2938,7 +2938,7 @@ func (p *Brontide) restartCoopClose(lnChan *lnwallet.LightningChannel) (
})
// An error other than ErrNoShutdownInfo was returned
case err != nil && !errors.Is(err, channeldb.ErrNoShutdownInfo):
case !errors.Is(err, channeldb.ErrNoShutdownInfo):
return nil, err
case errors.Is(err, channeldb.ErrNoShutdownInfo):
+3 -3
View File
@@ -5677,7 +5677,7 @@ sendLoop:
func (r *rpcServer) SendPaymentSync(ctx context.Context,
nextPayment *lnrpc.SendRequest) (*lnrpc.SendResponse, error) {
return r.sendPaymentSync(ctx, &rpcPaymentRequest{
return r.sendPaymentSync(&rpcPaymentRequest{
SendRequest: nextPayment,
})
}
@@ -5698,12 +5698,12 @@ func (r *rpcServer) SendToRouteSync(ctx context.Context,
return nil, err
}
return r.sendPaymentSync(ctx, paymentRequest)
return r.sendPaymentSync(paymentRequest)
}
// sendPaymentSync is the synchronous variant of sendPayment. It will block and
// wait until the payment has been fully completed.
func (r *rpcServer) sendPaymentSync(ctx context.Context,
func (r *rpcServer) sendPaymentSync(
nextPayment *rpcPaymentRequest) (*lnrpc.SendResponse, error) {
// We don't allow payments to be sent while the daemon itself is still