routing/pathfind_test: fmt whitespace

This commit is contained in:
Conner Fromknecht committed 2018-08-02 18:20:49 -07:00
1 parent 614b3b3862
commit 9eff876f52
1 file changed
+27 -27
+27 -27
View File
@@ -901,10 +901,10 @@ func TestNewRoute(t *testing.T) {
createHop := func(baseFee lnwire.MilliSatoshi, createHop := func(baseFee lnwire.MilliSatoshi,
feeRate lnwire.MilliSatoshi, feeRate lnwire.MilliSatoshi,
capacity btcutil.Amount, capacity btcutil.Amount,
timeLockDelta uint16) (*ChannelHop) { timeLockDelta uint16) *ChannelHop {
return &ChannelHop { return &ChannelHop{
ChannelEdgePolicy: &channeldb.ChannelEdgePolicy { ChannelEdgePolicy: &channeldb.ChannelEdgePolicy{
Node: &channeldb.LightningNode{}, Node: &channeldb.LightningNode{},
FeeProportionalMillionths: feeRate, FeeProportionalMillionths: feeRate,
FeeBaseMSat: baseFee, FeeBaseMSat: baseFee,
@@ -954,16 +954,16 @@ func TestNewRoute(t *testing.T) {
// expectedErrorCode indicates the expected error code when // expectedErrorCode indicates the expected error code when
// expectError is true. // expectError is true.
expectedErrorCode errorCode expectedErrorCode errorCode
} { }{
{ {
// For a single hop payment, no fees are expected to be paid. // For a single hop payment, no fees are expected to be paid.
name: "single hop", name: "single hop",
paymentAmount: 100000, paymentAmount: 100000,
hops: []*ChannelHop { hops: []*ChannelHop{
createHop(100, 1000, 1000, 10), createHop(100, 1000, 1000, 10),
}, },
expectedFees: []lnwire.MilliSatoshi {0}, expectedFees: []lnwire.MilliSatoshi{0},
expectedTimeLocks: []uint32 {1}, expectedTimeLocks: []uint32{1},
expectedTotalAmount: 100000, expectedTotalAmount: 100000,
expectedTotalTimeLock: 1, expectedTotalTimeLock: 1,
}, { }, {
@@ -972,19 +972,19 @@ func TestNewRoute(t *testing.T) {
// a fee to receive the payment. // a fee to receive the payment.
name: "two hop", name: "two hop",
paymentAmount: 100000, paymentAmount: 100000,
hops: []*ChannelHop { hops: []*ChannelHop{
createHop(0, 1000, 1000, 10), createHop(0, 1000, 1000, 10),
createHop(30, 1000, 1000, 5), createHop(30, 1000, 1000, 5),
}, },
expectedFees: []lnwire.MilliSatoshi {130, 0}, expectedFees: []lnwire.MilliSatoshi{130, 0},
expectedTimeLocks: []uint32 {1, 1}, expectedTimeLocks: []uint32{1, 1},
expectedTotalAmount: 100130, expectedTotalAmount: 100130,
expectedTotalTimeLock: 6, expectedTotalTimeLock: 6,
}, { }, {
// Insufficient capacity in first channel when fees are added. // Insufficient capacity in first channel when fees are added.
name: "two hop insufficient", name: "two hop insufficient",
paymentAmount: 100000, paymentAmount: 100000,
hops: []*ChannelHop { hops: []*ChannelHop{
createHop(0, 1000, 100, 10), createHop(0, 1000, 100, 10),
createHop(0, 1000, 1000, 5), createHop(0, 1000, 1000, 5),
}, },
@@ -998,14 +998,14 @@ func TestNewRoute(t *testing.T) {
// gets rounded down to 1. // gets rounded down to 1.
name: "three hop", name: "three hop",
paymentAmount: 100000, paymentAmount: 100000,
hops: []*ChannelHop { hops: []*ChannelHop{
createHop(0, 10, 1000, 10), createHop(0, 10, 1000, 10),
createHop(0, 10, 1000, 5), createHop(0, 10, 1000, 5),
createHop(0, 10, 1000, 3), createHop(0, 10, 1000, 3),
}, },
expectedFees: []lnwire.MilliSatoshi {1, 1, 0}, expectedFees: []lnwire.MilliSatoshi{1, 1, 0},
expectedTotalAmount: 100002, expectedTotalAmount: 100002,
expectedTimeLocks: []uint32 {4, 1, 1}, expectedTimeLocks: []uint32{4, 1, 1},
expectedTotalTimeLock: 9, expectedTotalTimeLock: 9,
}, { }, {
// A three hop payment where the fee of the first hop // A three hop payment where the fee of the first hop
@@ -1013,14 +1013,14 @@ func TestNewRoute(t *testing.T) {
// because of the increase amount to forward. // because of the increase amount to forward.
name: "three hop with fee carry over", name: "three hop with fee carry over",
paymentAmount: 100000, paymentAmount: 100000,
hops: []*ChannelHop { hops: []*ChannelHop{
createHop(0, 10000, 1000, 10), createHop(0, 10000, 1000, 10),
createHop(0, 10000, 1000, 5), createHop(0, 10000, 1000, 5),
createHop(0, 10000, 1000, 3), createHop(0, 10000, 1000, 3),
}, },
expectedFees: []lnwire.MilliSatoshi {1010, 1000, 0}, expectedFees: []lnwire.MilliSatoshi{1010, 1000, 0},
expectedTotalAmount: 102010, expectedTotalAmount: 102010,
expectedTimeLocks: []uint32 {4, 1, 1}, expectedTimeLocks: []uint32{4, 1, 1},
expectedTotalTimeLock: 9, expectedTotalTimeLock: 9,
}, { }, {
// A three hop payment where the fee policies of the first and // A three hop payment where the fee policies of the first and
@@ -1028,7 +1028,7 @@ func TestNewRoute(t *testing.T) {
// effect. // effect.
name: "three hop with minimal fees for carry over", name: "three hop with minimal fees for carry over",
paymentAmount: 100000, paymentAmount: 100000,
hops: []*ChannelHop { hops: []*ChannelHop{
createHop(0, 10000, 1000, 10), createHop(0, 10000, 1000, 10),
// First hop charges 0.1% so the second hop fee // First hop charges 0.1% so the second hop fee
@@ -1039,16 +1039,16 @@ func TestNewRoute(t *testing.T) {
// Second hop charges a fixed 1000 msat. // Second hop charges a fixed 1000 msat.
createHop(1000, 0, 1000, 3), createHop(1000, 0, 1000, 3),
}, },
expectedFees: []lnwire.MilliSatoshi {101, 1000, 0}, expectedFees: []lnwire.MilliSatoshi{101, 1000, 0},
expectedTotalAmount: 101101, expectedTotalAmount: 101101,
expectedTimeLocks: []uint32 {4, 1, 1}, expectedTimeLocks: []uint32{4, 1, 1},
expectedTotalTimeLock: 9, expectedTotalTimeLock: 9,
} } }}
for _, testCase := range testCases { for _, testCase := range testCases {
assertRoute := func(t *testing.T, route *Route) { assertRoute := func(t *testing.T, route *Route) {
if route.TotalAmount != testCase.expectedTotalAmount { if route.TotalAmount != testCase.expectedTotalAmount {
t.Errorf("Expected total amount is be %v" + t.Errorf("Expected total amount is be %v"+
", but got %v instead", ", but got %v instead",
testCase.expectedTotalAmount, testCase.expectedTotalAmount,
route.TotalAmount) route.TotalAmount)
@@ -1058,7 +1058,7 @@ func TestNewRoute(t *testing.T) {
if testCase.expectedFees[i] != if testCase.expectedFees[i] !=
route.Hops[i].Fee { route.Hops[i].Fee {
t.Errorf("Expected fee for hop %v to " + t.Errorf("Expected fee for hop %v to "+
"be %v, but got %v instead", "be %v, but got %v instead",
i, testCase.expectedFees[i], i, testCase.expectedFees[i],
route.Hops[i].Fee) route.Hops[i].Fee)
@@ -1070,7 +1070,7 @@ func TestNewRoute(t *testing.T) {
if route.TotalTimeLock != expectedTimeLockHeight { if route.TotalTimeLock != expectedTimeLockHeight {
t.Errorf("Expected total time lock to be %v" + t.Errorf("Expected total time lock to be %v"+
", but got %v instead", ", but got %v instead",
expectedTimeLockHeight, expectedTimeLockHeight,
route.TotalTimeLock) route.TotalTimeLock)
@@ -1083,7 +1083,7 @@ func TestNewRoute(t *testing.T) {
if expectedTimeLockHeight != if expectedTimeLockHeight !=
route.Hops[i].OutgoingTimeLock { route.Hops[i].OutgoingTimeLock {
t.Errorf("Expected time lock for hop " + t.Errorf("Expected time lock for hop "+
"%v to be %v, but got %v instead", "%v to be %v, but got %v instead",
i, expectedTimeLockHeight, i, expectedTimeLockHeight,
route.Hops[i].OutgoingTimeLock) route.Hops[i].OutgoingTimeLock)
@@ -1100,8 +1100,8 @@ func TestNewRoute(t *testing.T) {
if testCase.expectError { if testCase.expectError {
expectedCode := testCase.expectedErrorCode expectedCode := testCase.expectedErrorCode
if err == nil || !IsError(err, expectedCode) { if err == nil || !IsError(err, expectedCode) {
t.Errorf("expected newRoute to fail " + t.Errorf("expected newRoute to fail "+
"with error code %v, but got" + "with error code %v, but got"+
"%v instead", "%v instead",
expectedCode, err) expectedCode, err)
} }