mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-20 22:44:31 +01:00
add test
This commit is contained in:
@@ -73,8 +73,7 @@ public class MultiPathPaymentSplitter {
|
||||
List<Route> routes = getWithLiquidityInformation(extendedBasicRoutes);
|
||||
List<Route> fixedRoutes = Routes.getFixedWithTotalAmount(routes, amount);
|
||||
|
||||
boolean isTooExpensive = isTooExpensive(paymentOptions, fixedRoutes);
|
||||
if (isTooExpensive) {
|
||||
if (isTooExpensive(paymentOptions, fixedRoutes)) {
|
||||
return MultiPathPayment.FAILURE;
|
||||
}
|
||||
return new MultiPathPayment(fixedRoutes);
|
||||
|
||||
@@ -163,6 +163,24 @@ class MultiPathPaymentSplitterTest {
|
||||
assertThat(multiPathPayment.isFailure()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void fee_rate_at_limit_excluding_fees_from_first_hop() {
|
||||
int feeRate = 200;
|
||||
Coins amount = Coins.ofSatoshis(3_000_000);
|
||||
Policy policy = policyFor(feeRate);
|
||||
PaymentOptions paymentOptions = PaymentOptions.forFeeRateLimit(feeRate);
|
||||
Flow firstEdgeFlow = new Flow(firstEdge, amount);
|
||||
Edge edge = new Edge(CHANNEL_ID_2, PUBKEY_2, PUBKEY_4, CAPACITY, policy);
|
||||
Flow flow = new Flow(edge, amount);
|
||||
addEdgeWithoutInformation(edge);
|
||||
when(flowComputation.getOptimalFlows(PUBKEY, PUBKEY_4, amount, paymentOptions))
|
||||
.thenReturn(new Flows(firstEdgeFlow, flow));
|
||||
|
||||
MultiPathPayment multiPathPayment =
|
||||
multiPathPaymentSplitter.getMultiPathPayment(PUBKEY, PUBKEY_4, amount, paymentOptions);
|
||||
assertThat(multiPathPayment.isFailure()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void one_flow_has_fee_rate_above_limit_but_average_fee_rate_is_below_limit_including_fees_from_first_hop() {
|
||||
mockExtensionEdge(PUBKEY_4);
|
||||
|
||||
Reference in New Issue
Block a user