routing/pathfind_test: fmt whitespace
This commit is contained in:
1 file changed
+27
-27
+27
-27
@@ -901,10 +901,10 @@ func TestNewRoute(t *testing.T) {
|
||||
createHop := func(baseFee lnwire.MilliSatoshi,
|
||||
feeRate lnwire.MilliSatoshi,
|
||||
capacity btcutil.Amount,
|
||||
timeLockDelta uint16) (*ChannelHop) {
|
||||
timeLockDelta uint16) *ChannelHop {
|
||||
|
||||
return &ChannelHop {
|
||||
ChannelEdgePolicy: &channeldb.ChannelEdgePolicy {
|
||||
return &ChannelHop{
|
||||
ChannelEdgePolicy: &channeldb.ChannelEdgePolicy{
|
||||
Node: &channeldb.LightningNode{},
|
||||
FeeProportionalMillionths: feeRate,
|
||||
FeeBaseMSat: baseFee,
|
||||
@@ -954,16 +954,16 @@ func TestNewRoute(t *testing.T) {
|
||||
// expectedErrorCode indicates the expected error code when
|
||||
// expectError is true.
|
||||
expectedErrorCode errorCode
|
||||
} {
|
||||
}{
|
||||
{
|
||||
// For a single hop payment, no fees are expected to be paid.
|
||||
name: "single hop",
|
||||
paymentAmount: 100000,
|
||||
hops: []*ChannelHop {
|
||||
hops: []*ChannelHop{
|
||||
createHop(100, 1000, 1000, 10),
|
||||
},
|
||||
expectedFees: []lnwire.MilliSatoshi {0},
|
||||
expectedTimeLocks: []uint32 {1},
|
||||
expectedFees: []lnwire.MilliSatoshi{0},
|
||||
expectedTimeLocks: []uint32{1},
|
||||
expectedTotalAmount: 100000,
|
||||
expectedTotalTimeLock: 1,
|
||||
}, {
|
||||
@@ -972,19 +972,19 @@ func TestNewRoute(t *testing.T) {
|
||||
// a fee to receive the payment.
|
||||
name: "two hop",
|
||||
paymentAmount: 100000,
|
||||
hops: []*ChannelHop {
|
||||
hops: []*ChannelHop{
|
||||
createHop(0, 1000, 1000, 10),
|
||||
createHop(30, 1000, 1000, 5),
|
||||
},
|
||||
expectedFees: []lnwire.MilliSatoshi {130, 0},
|
||||
expectedTimeLocks: []uint32 {1, 1},
|
||||
expectedFees: []lnwire.MilliSatoshi{130, 0},
|
||||
expectedTimeLocks: []uint32{1, 1},
|
||||
expectedTotalAmount: 100130,
|
||||
expectedTotalTimeLock: 6,
|
||||
}, {
|
||||
// Insufficient capacity in first channel when fees are added.
|
||||
name: "two hop insufficient",
|
||||
paymentAmount: 100000,
|
||||
hops: []*ChannelHop {
|
||||
hops: []*ChannelHop{
|
||||
createHop(0, 1000, 100, 10),
|
||||
createHop(0, 1000, 1000, 5),
|
||||
},
|
||||
@@ -998,14 +998,14 @@ func TestNewRoute(t *testing.T) {
|
||||
// gets rounded down to 1.
|
||||
name: "three hop",
|
||||
paymentAmount: 100000,
|
||||
hops: []*ChannelHop {
|
||||
hops: []*ChannelHop{
|
||||
createHop(0, 10, 1000, 10),
|
||||
createHop(0, 10, 1000, 5),
|
||||
createHop(0, 10, 1000, 3),
|
||||
},
|
||||
expectedFees: []lnwire.MilliSatoshi {1, 1, 0},
|
||||
expectedFees: []lnwire.MilliSatoshi{1, 1, 0},
|
||||
expectedTotalAmount: 100002,
|
||||
expectedTimeLocks: []uint32 {4, 1, 1},
|
||||
expectedTimeLocks: []uint32{4, 1, 1},
|
||||
expectedTotalTimeLock: 9,
|
||||
}, {
|
||||
// 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.
|
||||
name: "three hop with fee carry over",
|
||||
paymentAmount: 100000,
|
||||
hops: []*ChannelHop {
|
||||
hops: []*ChannelHop{
|
||||
createHop(0, 10000, 1000, 10),
|
||||
createHop(0, 10000, 1000, 5),
|
||||
createHop(0, 10000, 1000, 3),
|
||||
},
|
||||
expectedFees: []lnwire.MilliSatoshi {1010, 1000, 0},
|
||||
expectedFees: []lnwire.MilliSatoshi{1010, 1000, 0},
|
||||
expectedTotalAmount: 102010,
|
||||
expectedTimeLocks: []uint32 {4, 1, 1},
|
||||
expectedTimeLocks: []uint32{4, 1, 1},
|
||||
expectedTotalTimeLock: 9,
|
||||
}, {
|
||||
// A three hop payment where the fee policies of the first and
|
||||
@@ -1028,7 +1028,7 @@ func TestNewRoute(t *testing.T) {
|
||||
// effect.
|
||||
name: "three hop with minimal fees for carry over",
|
||||
paymentAmount: 100000,
|
||||
hops: []*ChannelHop {
|
||||
hops: []*ChannelHop{
|
||||
createHop(0, 10000, 1000, 10),
|
||||
|
||||
// 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.
|
||||
createHop(1000, 0, 1000, 3),
|
||||
},
|
||||
expectedFees: []lnwire.MilliSatoshi {101, 1000, 0},
|
||||
expectedFees: []lnwire.MilliSatoshi{101, 1000, 0},
|
||||
expectedTotalAmount: 101101,
|
||||
expectedTimeLocks: []uint32 {4, 1, 1},
|
||||
expectedTimeLocks: []uint32{4, 1, 1},
|
||||
expectedTotalTimeLock: 9,
|
||||
} }
|
||||
}}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
assertRoute := func(t *testing.T, route *Route) {
|
||||
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",
|
||||
testCase.expectedTotalAmount,
|
||||
route.TotalAmount)
|
||||
@@ -1058,7 +1058,7 @@ func TestNewRoute(t *testing.T) {
|
||||
if testCase.expectedFees[i] !=
|
||||
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",
|
||||
i, testCase.expectedFees[i],
|
||||
route.Hops[i].Fee)
|
||||
@@ -1070,7 +1070,7 @@ func TestNewRoute(t *testing.T) {
|
||||
|
||||
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",
|
||||
expectedTimeLockHeight,
|
||||
route.TotalTimeLock)
|
||||
@@ -1083,7 +1083,7 @@ func TestNewRoute(t *testing.T) {
|
||||
if expectedTimeLockHeight !=
|
||||
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",
|
||||
i, expectedTimeLockHeight,
|
||||
route.Hops[i].OutgoingTimeLock)
|
||||
@@ -1100,8 +1100,8 @@ func TestNewRoute(t *testing.T) {
|
||||
if testCase.expectError {
|
||||
expectedCode := testCase.expectedErrorCode
|
||||
if err == nil || !IsError(err, expectedCode) {
|
||||
t.Errorf("expected newRoute to fail " +
|
||||
"with error code %v, but got" +
|
||||
t.Errorf("expected newRoute to fail "+
|
||||
"with error code %v, but got"+
|
||||
"%v instead",
|
||||
expectedCode, err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user