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