mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-10 17:01:32 +02:00
multi: fix issues reported by whitespace linter
This commit is contained in:
parent
8d83778314
commit
13f187046b
@ -1463,7 +1463,6 @@ func (d *DB) InvoicesSettledSince(sinceSettleIndex uint64) ([]Invoice, error) {
|
|||||||
seqNo, indexValue := invoiceCursor.Next()
|
seqNo, indexValue := invoiceCursor.Next()
|
||||||
|
|
||||||
for ; seqNo != nil && bytes.Compare(seqNo, startIndex[:]) > 0; seqNo, indexValue = invoiceCursor.Next() {
|
for ; seqNo != nil && bytes.Compare(seqNo, startIndex[:]) > 0; seqNo, indexValue = invoiceCursor.Next() {
|
||||||
|
|
||||||
// Depending on the length of the index value, this may
|
// Depending on the length of the index value, this may
|
||||||
// or may not be an AMP invoice, so we'll extract the
|
// or may not be an AMP invoice, so we'll extract the
|
||||||
// invoice value into two components: the invoice num,
|
// invoice value into two components: the invoice num,
|
||||||
|
@ -81,8 +81,8 @@ func MigrateFwdPkgCleanup(tx kvdb.RwTx) error {
|
|||||||
|
|
||||||
// Otherwise, wipe all the forwarding packages.
|
// Otherwise, wipe all the forwarding packages.
|
||||||
if err := fwdPkgBkt.DeleteNestedBucket(
|
if err := fwdPkgBkt.DeleteNestedBucket(
|
||||||
sourceBytes[:]); err != nil {
|
sourceBytes[:],
|
||||||
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -615,9 +615,8 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
|||||||
test := test
|
test := test
|
||||||
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
err := kvdb.Update(db,
|
err := kvdb.Update(
|
||||||
func(tx walletdb.ReadWriteTx) error {
|
db, func(tx walletdb.ReadWriteTx) error {
|
||||||
|
|
||||||
var seqNrBytes [8]byte
|
var seqNrBytes [8]byte
|
||||||
byteOrder.PutUint64(
|
byteOrder.PutUint64(
|
||||||
seqNrBytes[:], test.sequenceNumber,
|
seqNrBytes[:], test.sequenceNumber,
|
||||||
@ -627,7 +626,8 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
|||||||
tx, test.paymentHash, seqNrBytes[:],
|
tx, test.paymentHash, seqNrBytes[:],
|
||||||
)
|
)
|
||||||
return err
|
return err
|
||||||
}, func() {})
|
}, func() {},
|
||||||
|
)
|
||||||
require.Equal(t, test.expectedErr, err)
|
require.Equal(t, test.expectedErr, err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,7 @@ func newTestBoltArbLog(chainhash chainhash.Hash,
|
|||||||
testArbCfg := ChannelArbitratorConfig{
|
testArbCfg := ChannelArbitratorConfig{
|
||||||
PutResolverReport: func(_ kvdb.RwTx,
|
PutResolverReport: func(_ kvdb.RwTx,
|
||||||
_ *channeldb.ResolverReport) error {
|
_ *channeldb.ResolverReport) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -383,6 +383,7 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
|
|||||||
},
|
},
|
||||||
MarkChannelClosed: func(*channeldb.ChannelCloseSummary,
|
MarkChannelClosed: func(*channeldb.ChannelCloseSummary,
|
||||||
...channeldb.ChannelStatus) error {
|
...channeldb.ChannelStatus) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
IsPendingClose: false,
|
IsPendingClose: false,
|
||||||
@ -1635,6 +1636,7 @@ func TestChannelArbitratorCommitFailure(t *testing.T) {
|
|||||||
chanArb.cfg.MarkChannelClosed = func(
|
chanArb.cfg.MarkChannelClosed = func(
|
||||||
*channeldb.ChannelCloseSummary,
|
*channeldb.ChannelCloseSummary,
|
||||||
...channeldb.ChannelStatus) error {
|
...channeldb.ChannelStatus) error {
|
||||||
|
|
||||||
close(closed)
|
close(closed)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2169,6 +2171,7 @@ func TestRemoteCloseInitiator(t *testing.T) {
|
|||||||
// about setting of channel status.
|
// about setting of channel status.
|
||||||
mockMarkClosed := func(_ *channeldb.ChannelCloseSummary,
|
mockMarkClosed := func(_ *channeldb.ChannelCloseSummary,
|
||||||
statuses ...channeldb.ChannelStatus) error {
|
statuses ...channeldb.ChannelStatus) error {
|
||||||
|
|
||||||
for _, status := range statuses {
|
for _, status := range statuses {
|
||||||
err := alice.State().ApplyChanStatus(status)
|
err := alice.State().ApplyChanStatus(status)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -62,6 +62,7 @@ func newHtlcResolverTestContext(t *testing.T,
|
|||||||
Sweeper: newMockSweeper(),
|
Sweeper: newMockSweeper(),
|
||||||
IncubateOutputs: func(wire.OutPoint, *lnwallet.OutgoingHtlcResolution,
|
IncubateOutputs: func(wire.OutPoint, *lnwallet.OutgoingHtlcResolution,
|
||||||
*lnwallet.IncomingHtlcResolution, uint32) error {
|
*lnwallet.IncomingHtlcResolution, uint32) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
DeliverResolutionMsg: func(msgs ...ResolutionMsg) error {
|
DeliverResolutionMsg: func(msgs ...ResolutionMsg) error {
|
||||||
@ -86,6 +87,7 @@ func newHtlcResolverTestContext(t *testing.T,
|
|||||||
// this so set nolint directive.
|
// this so set nolint directive.
|
||||||
checkpointFunc := func(c ContractResolver, // nolint
|
checkpointFunc := func(c ContractResolver, // nolint
|
||||||
r ...*channeldb.ResolverReport) error {
|
r ...*channeldb.ResolverReport) error {
|
||||||
|
|
||||||
return testCtx.checkpoint(c, r...)
|
return testCtx.checkpoint(c, r...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,6 +255,7 @@ func TestHtlcSuccessSecondStageResolution(t *testing.T) {
|
|||||||
// to resolve our htlc.
|
// to resolve our htlc.
|
||||||
preCheckpoint: func(ctx *htlcResolverTestContext,
|
preCheckpoint: func(ctx *htlcResolverTestContext,
|
||||||
_ bool) error {
|
_ bool) error {
|
||||||
|
|
||||||
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||||
SpendingTx: sweepTx,
|
SpendingTx: sweepTx,
|
||||||
SpenderTxHash: &sweepHash,
|
SpenderTxHash: &sweepHash,
|
||||||
|
@ -861,6 +861,7 @@ func TestHtlcTimeoutSecondStageRemoteSpend(t *testing.T) {
|
|||||||
// success transcation.
|
// success transcation.
|
||||||
preCheckpoint: func(ctx *htlcResolverTestContext,
|
preCheckpoint: func(ctx *htlcResolverTestContext,
|
||||||
_ bool) error {
|
_ bool) error {
|
||||||
|
|
||||||
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||||
SpendingTx: remoteSuccessTx,
|
SpendingTx: remoteSuccessTx,
|
||||||
SpenderTxHash: &successTxid,
|
SpenderTxHash: &successTxid,
|
||||||
|
@ -208,6 +208,7 @@ func newMailboxContext(t *testing.T, startTime time.Time,
|
|||||||
ctx.mailbox = newMemoryMailBox(&mailBoxConfig{
|
ctx.mailbox = newMemoryMailBox(&mailBoxConfig{
|
||||||
fetchUpdate: func(sid lnwire.ShortChannelID) (
|
fetchUpdate: func(sid lnwire.ShortChannelID) (
|
||||||
*lnwire.ChannelUpdate, error) {
|
*lnwire.ChannelUpdate, error) {
|
||||||
|
|
||||||
return &lnwire.ChannelUpdate{
|
return &lnwire.ChannelUpdate{
|
||||||
ShortChannelID: sid,
|
ShortChannelID: sid,
|
||||||
}, nil
|
}, nil
|
||||||
@ -671,12 +672,14 @@ func TestMailOrchestrator(t *testing.T) {
|
|||||||
mo := newMailOrchestrator(&mailOrchConfig{
|
mo := newMailOrchestrator(&mailOrchConfig{
|
||||||
fetchUpdate: func(sid lnwire.ShortChannelID) (
|
fetchUpdate: func(sid lnwire.ShortChannelID) (
|
||||||
*lnwire.ChannelUpdate, error) {
|
*lnwire.ChannelUpdate, error) {
|
||||||
|
|
||||||
return &lnwire.ChannelUpdate{
|
return &lnwire.ChannelUpdate{
|
||||||
ShortChannelID: sid,
|
ShortChannelID: sid,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
forwardPackets: func(_ chan struct{},
|
forwardPackets: func(_ chan struct{},
|
||||||
pkts ...*htlcPacket) error {
|
pkts ...*htlcPacket) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
clock: clock.NewTestClock(time.Now()),
|
clock: clock.NewTestClock(time.Now()),
|
||||||
|
@ -70,7 +70,6 @@ func lockInputs(w lnwallet.WalletController, packet *psbt.Packet) (
|
|||||||
if err := w.ReleaseOutput(
|
if err := w.ReleaseOutput(
|
||||||
LndInternalLockID, op,
|
LndInternalLockID, op,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
|
|
||||||
log.Errorf("could not release the "+
|
log.Errorf("could not release the "+
|
||||||
"lock on %v: %v", op, err)
|
"lock on %v: %v", op, err)
|
||||||
}
|
}
|
||||||
|
@ -297,6 +297,7 @@ func testUnconfirmedChannelFunding(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// response to a channel balance RPC.
|
// response to a channel balance RPC.
|
||||||
checkChannelBalance := func(node *lntest.HarnessNode,
|
checkChannelBalance := func(node *lntest.HarnessNode,
|
||||||
local, remote, pendingLocal, pendingRemote btcutil.Amount) {
|
local, remote, pendingLocal, pendingRemote btcutil.Amount) {
|
||||||
|
|
||||||
expectedResponse := &lnrpc.ChannelBalanceResponse{
|
expectedResponse := &lnrpc.ChannelBalanceResponse{
|
||||||
LocalBalance: &lnrpc.Amount{
|
LocalBalance: &lnrpc.Amount{
|
||||||
Sat: uint64(local),
|
Sat: uint64(local),
|
||||||
|
@ -614,8 +614,8 @@ func createTestGraphFromChannels(useCache bool, testChannels []*testChannel,
|
|||||||
|
|
||||||
for _, testChannel := range testChannels {
|
for _, testChannel := range testChannels {
|
||||||
for _, node := range []*testChannelEnd{
|
for _, node := range []*testChannelEnd{
|
||||||
testChannel.Node1, testChannel.Node2} {
|
testChannel.Node1, testChannel.Node2,
|
||||||
|
} {
|
||||||
_, exists := aliasMap[node.Alias]
|
_, exists := aliasMap[node.Alias]
|
||||||
if !exists {
|
if !exists {
|
||||||
var features *lnwire.FeatureVector
|
var features *lnwire.FeatureVector
|
||||||
|
@ -779,7 +779,6 @@ func (p *shardHandler) handleSendError(attempt *channeldb.HTLCAttemptInfo,
|
|||||||
if err := p.router.cfg.Control.Fail(
|
if err := p.router.cfg.Control.Fail(
|
||||||
p.identifier, *reason,
|
p.identifier, *reason,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
|
|
||||||
log.Errorf("unable to report failure to control "+
|
log.Errorf("unable to report failure to control "+
|
||||||
"tower: %v", err)
|
"tower: %v", err)
|
||||||
|
|
||||||
|
@ -670,7 +670,6 @@ func TestSendPaymentErrorFeeInsufficientPrivateEdge(t *testing.T) {
|
|||||||
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
|
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
|
||||||
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
||||||
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
||||||
|
|
||||||
if firstHop != roasbeefSongoku || errorReturned {
|
if firstHop != roasbeefSongoku || errorReturned {
|
||||||
return preImage, nil
|
return preImage, nil
|
||||||
}
|
}
|
||||||
@ -685,7 +684,8 @@ func TestSendPaymentErrorFeeInsufficientPrivateEdge(t *testing.T) {
|
|||||||
Update: errChanUpdate,
|
Update: errChanUpdate,
|
||||||
}, 1,
|
}, 1,
|
||||||
)
|
)
|
||||||
})
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// Send off the payment request to the router, route through son
|
// Send off the payment request to the router, route through son
|
||||||
// goku and then across the private channel to elst.
|
// goku and then across the private channel to elst.
|
||||||
@ -802,7 +802,6 @@ func TestSendPaymentPrivateEdgeUpdateFeeExceedsLimit(t *testing.T) {
|
|||||||
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
|
copy(preImage[:], bytes.Repeat([]byte{9}, 32))
|
||||||
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
||||||
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
||||||
|
|
||||||
if firstHop != roasbeefSongoku || errorReturned {
|
if firstHop != roasbeefSongoku || errorReturned {
|
||||||
return preImage, nil
|
return preImage, nil
|
||||||
}
|
}
|
||||||
@ -817,7 +816,8 @@ func TestSendPaymentPrivateEdgeUpdateFeeExceedsLimit(t *testing.T) {
|
|||||||
Update: errChanUpdate,
|
Update: errChanUpdate,
|
||||||
}, 1,
|
}, 1,
|
||||||
)
|
)
|
||||||
})
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// Send off the payment request to the router, route through son
|
// Send off the payment request to the router, route through son
|
||||||
// goku and then across the private channel to elst.
|
// goku and then across the private channel to elst.
|
||||||
@ -3071,7 +3071,6 @@ func TestSendToRouteMultiShardSend(t *testing.T) {
|
|||||||
|
|
||||||
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcherOld).setPaymentResult(
|
||||||
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
|
||||||
|
|
||||||
// Signal that the shard has been initiated and is
|
// Signal that the shard has been initiated and is
|
||||||
// waiting for a result.
|
// waiting for a result.
|
||||||
waitForResultSignal <- struct{}{}
|
waitForResultSignal <- struct{}{}
|
||||||
@ -3082,7 +3081,8 @@ func TestSendToRouteMultiShardSend(t *testing.T) {
|
|||||||
return [32]byte{}, fmt.Errorf("failure")
|
return [32]byte{}, fmt.Errorf("failure")
|
||||||
}
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
})
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// Launch three shards by calling SendToRoute in three goroutines,
|
// Launch three shards by calling SendToRoute in three goroutines,
|
||||||
// returning their final error on the channel.
|
// returning their final error on the channel.
|
||||||
|
@ -1653,7 +1653,6 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
|
|||||||
if err := r.server.ConnectToPeer(
|
if err := r.server.ConnectToPeer(
|
||||||
peerAddr, in.Perm, timeout,
|
peerAddr, in.Perm, timeout,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
|
|
||||||
rpcsLog.Errorf(
|
rpcsLog.Errorf(
|
||||||
"[connectpeer]: error connecting to peer: %v", err,
|
"[connectpeer]: error connecting to peer: %v", err,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user