multi: formatting and comment fixes
This commit is contained in:
160 files changed
+159
-260
No files matched your search
@@ -72,6 +72,7 @@ func newBandwidthManager(graph routingGraph, sourceNode route.Vertex,
|
||||
// is interpreted as the link being offline.
|
||||
func (b *bandwidthManager) getBandwidth(cid lnwire.ShortChannelID,
|
||||
amount lnwire.MilliSatoshi) lnwire.MilliSatoshi {
|
||||
|
||||
link, err := b.getLink(cid)
|
||||
if err != nil {
|
||||
// If the link isn't online, then we'll report that it has
|
||||
|
||||
@@ -64,6 +64,7 @@ var _ FilteredChainView = (*CfFilteredChainView)(nil)
|
||||
// this function.
|
||||
func NewCfFilteredChainView(node *neutrino.ChainService,
|
||||
blockCache *blockcache.BlockCache) (*CfFilteredChainView, error) {
|
||||
|
||||
return &CfFilteredChainView{
|
||||
blockQueue: newBlockEventQueue(),
|
||||
quit: make(chan struct{}),
|
||||
|
||||
@@ -190,7 +190,6 @@ func (r *Manager) updateEdge(tx kvdb.RTx, chanPoint wire.OutPoint,
|
||||
|
||||
// We now update the edge max htlc value.
|
||||
switch {
|
||||
|
||||
// If a non-zero max htlc was specified, use it to update the edge.
|
||||
// Otherwise keep the value unchanged.
|
||||
case newSchema.MaxHTLC != 0:
|
||||
|
||||
@@ -90,5 +90,4 @@ func TestMissionControlStateSetLastPairResult(t *testing.T) {
|
||||
SuccessAmt: 50,
|
||||
}
|
||||
require.Equal(t, expected, result[to])
|
||||
|
||||
}
|
||||
@@ -632,6 +632,7 @@ var _ PaymentSession = (*mockPaymentSession)(nil)
|
||||
|
||||
func (m *mockPaymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
|
||||
activeShards, height uint32) (*route.Route, error) {
|
||||
|
||||
args := m.Called(maxAmt, feeLimit, activeShards, height)
|
||||
return args.Get(0).(*route.Route), args.Error(1)
|
||||
}
|
||||
|
||||
@@ -1556,6 +1556,7 @@ func TestNewRoute(t *testing.T) {
|
||||
if !reflect.DeepEqual(
|
||||
finalHop.MPP, testCase.expectedMPP,
|
||||
) {
|
||||
|
||||
t.Errorf("Expected final hop mpp field: %v, "+
|
||||
" but got: %v instead",
|
||||
testCase.expectedMPP, finalHop.MPP)
|
||||
@@ -1713,7 +1714,6 @@ func runDestTLVGraphFallback(t *testing.T, useCache bool) {
|
||||
sourceNode, err := ctx.graph.SourceNode()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to fetch source node: %v", err)
|
||||
|
||||
}
|
||||
|
||||
find := func(r *RestrictParams,
|
||||
|
||||
@@ -180,7 +180,6 @@ lifecycle:
|
||||
// TODO(yy): sanity check all the states to make sure
|
||||
// everything is expected.
|
||||
switch {
|
||||
|
||||
// We have a terminal condition and no active shards, we are
|
||||
// ready to exit.
|
||||
case currentState.terminated():
|
||||
@@ -470,7 +469,6 @@ type shardResult struct {
|
||||
// given HTLC attempt to be available then handle its result. It will fail the
|
||||
// payment with the control tower if a terminal error is encountered.
|
||||
func (p *shardHandler) collectResultAsync(attempt *channeldb.HTLCAttemptInfo) {
|
||||
|
||||
// errToSend is the error to be sent to sh.shardErrors.
|
||||
var errToSend error
|
||||
|
||||
@@ -557,7 +555,6 @@ func (p *shardHandler) collectResult(attempt *channeldb.HTLCAttemptInfo) (
|
||||
attempt.AttemptID, p.identifier, errorDecryptor,
|
||||
)
|
||||
switch {
|
||||
|
||||
// If this attempt ID is unknown to the Switch, it means it was never
|
||||
// checkpointed and forwarded by the switch before a restart. In this
|
||||
// case we can safely send a new payment attempt, and wait for its
|
||||
@@ -780,7 +777,8 @@ func (p *shardHandler) handleSendError(attempt *channeldb.HTLCAttemptInfo,
|
||||
|
||||
// Fail the payment via control tower.
|
||||
if err := p.router.cfg.Control.Fail(
|
||||
p.identifier, *reason); err != nil {
|
||||
p.identifier, *reason,
|
||||
); err != nil {
|
||||
|
||||
log.Errorf("unable to report failure to control "+
|
||||
"tower: %v", err)
|
||||
@@ -968,7 +966,6 @@ func marshallError(sendError error, time time.Time) *channeldb.HTLCFailInfo {
|
||||
}
|
||||
|
||||
switch sendError {
|
||||
|
||||
case htlcswitch.ErrPaymentIDNotFound:
|
||||
response.Reason = channeldb.HTLCFailInternal
|
||||
return response
|
||||
|
||||
@@ -570,7 +570,6 @@ func testPaymentLifecycle(t *testing.T, test paymentLifecycleTestCase,
|
||||
}
|
||||
|
||||
switch step {
|
||||
|
||||
case routerInitPayment:
|
||||
var args initArgs
|
||||
select {
|
||||
@@ -934,7 +933,6 @@ func TestPaymentState(t *testing.T) {
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TestUpdatePaymentState checks that the method updatePaymentState updates the
|
||||
@@ -1071,7 +1069,6 @@ func TestUpdatePaymentState(t *testing.T) {
|
||||
ct.On("FetchPayment", paymentHash).Return(
|
||||
nil, dummyErr,
|
||||
)
|
||||
|
||||
} else {
|
||||
// Otherwise we will return the payment.
|
||||
ct.On("FetchPayment", paymentHash).Return(
|
||||
@@ -1096,10 +1093,8 @@ func TestUpdatePaymentState(t *testing.T) {
|
||||
t, tc.expectedState, state,
|
||||
"state not updated as expected",
|
||||
)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func makeActiveAttempt(total, fee int) channeldb.HTLCAttempt {
|
||||
|
||||
@@ -72,7 +72,7 @@ var (
|
||||
DefaultShardMinAmt = lnwire.NewMSatFromSatoshis(10000)
|
||||
)
|
||||
|
||||
// Error returns the string representation of the noRouteError
|
||||
// Error returns the string representation of the noRouteError.
|
||||
func (e noRouteError) Error() string {
|
||||
switch e {
|
||||
case errNoTlvPayload:
|
||||
|
||||
@@ -76,7 +76,6 @@ func TestValidateCLTVLimit(t *testing.T) {
|
||||
// TestUpdateAdditionalEdge checks that we can update the additional edges as
|
||||
// expected.
|
||||
func TestUpdateAdditionalEdge(t *testing.T) {
|
||||
|
||||
var (
|
||||
testChannelID = uint64(12345)
|
||||
oldFeeBaseMSat = uint32(1000)
|
||||
|
||||
@@ -118,7 +118,6 @@ func (p *probabilityEstimator) getNodeProbability(now time.Time,
|
||||
|
||||
for _, result := range results {
|
||||
switch {
|
||||
|
||||
// Weigh success with a constant high weight of 1. There is no
|
||||
// decay. Amt is never zero, so this clause is never executed
|
||||
// when result.SuccessAmt is zero.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// Define node identifiers
|
||||
// Define node identifiers.
|
||||
node1 = 1
|
||||
node2 = 2
|
||||
node3 = 3
|
||||
|
||||
@@ -2110,7 +2110,6 @@ func (r *ChannelRouter) preparePayment(payment *LightningPayment) (
|
||||
// this payment.
|
||||
var shardTracker shards.ShardTracker
|
||||
switch {
|
||||
|
||||
// If this is an AMP payment, we'll use the AMP shard tracker.
|
||||
case payment.amp != nil:
|
||||
shardTracker = amp.NewShardTracker(
|
||||
|
||||
@@ -3822,7 +3822,6 @@ func TestSendMPPaymentSucceedOnExtraShards(t *testing.T) {
|
||||
payment.HTLCs[i] = attempt
|
||||
return
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// Setup ReportPaymentFail to return nil reason and error so the
|
||||
@@ -4006,7 +4005,6 @@ func TestSendMPPaymentFailed(t *testing.T) {
|
||||
),
|
||||
}
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// We will make the rest attempts failed with temporary error.
|
||||
@@ -4035,7 +4033,6 @@ func TestSendMPPaymentFailed(t *testing.T) {
|
||||
payment.HTLCs[i] = attempt
|
||||
return
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// Setup ReportPaymentFail to return nil reason and error so the
|
||||
|
||||
Reference in new issue
Block a user