mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-21 06:54:29 +01:00
include MPP fee rate in output
This commit is contained in:
@@ -49,6 +49,7 @@ class PickhardtPaymentsControllerIT {
|
||||
.andExpect(jsonPath("$.probability", is(expectedProbability)))
|
||||
.andExpect(jsonPath("$.amountSat", is(amountAsString)))
|
||||
.andExpect(jsonPath("$.feesMilliSat", is(feesAsString)))
|
||||
.andExpect(jsonPath("$.feeRate", is(200)))
|
||||
.andExpect(jsonPath("$.routes", hasSize(1)))
|
||||
.andExpect(jsonPath("$.routes[0].amountSat", is(amountAsString)))
|
||||
.andExpect(jsonPath("$.routes[0].channelIds", contains(CHANNEL_ID.toString())))
|
||||
@@ -59,6 +60,7 @@ class PickhardtPaymentsControllerIT {
|
||||
void send() throws Exception {
|
||||
Coins amount = MULTI_PATH_PAYMENT.amount();
|
||||
String amountAsString = String.valueOf(amount.satoshis());
|
||||
String feesAsString = String.valueOf(MULTI_PATH_PAYMENT.fees().milliSatoshis());
|
||||
double expectedProbability = MULTI_PATH_PAYMENT.probability();
|
||||
when(multiPathPaymentSplitter.getMultiPathPaymentTo(PUBKEY, amount))
|
||||
.thenReturn(MULTI_PATH_PAYMENT);
|
||||
@@ -67,6 +69,8 @@ class PickhardtPaymentsControllerIT {
|
||||
mockMvc.perform(get(PREFIX + "/from/" + PUBKEY + "/to/" + PUBKEY_2 + "/amount/" + 1_234))
|
||||
.andExpect(jsonPath("$.probability", is(expectedProbability)))
|
||||
.andExpect(jsonPath("$.amountSat", is(amountAsString)))
|
||||
.andExpect(jsonPath("$.feesMilliSat", is(feesAsString)))
|
||||
.andExpect(jsonPath("$.feeRate", is(200)))
|
||||
.andExpect(jsonPath("$.routes", hasSize(1)))
|
||||
.andExpect(jsonPath("$.routes[0].amountSat", is(amountAsString)))
|
||||
.andExpect(jsonPath("$.routes[0].channelIds", contains(CHANNEL_ID.toString())))
|
||||
|
||||
@@ -7,12 +7,19 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public record MultiPathPaymentDto(String amountSat, double probability, String feesMilliSat, List<RouteDto> routes) {
|
||||
public record MultiPathPaymentDto(
|
||||
String amountSat,
|
||||
double probability,
|
||||
String feesMilliSat,
|
||||
long feeRate,
|
||||
List<RouteDto> routes
|
||||
) {
|
||||
public static MultiPathPaymentDto fromModel(MultiPathPayment multiPathPayment) {
|
||||
return new MultiPathPaymentDto(
|
||||
String.valueOf(multiPathPayment.amount().satoshis()),
|
||||
multiPathPayment.probability(),
|
||||
String.valueOf(multiPathPayment.fees().milliSatoshis()),
|
||||
multiPathPayment.getFeeRate(),
|
||||
getRoutes(multiPathPayment.routes())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class MultiPathPaymentDtoTest {
|
||||
amountSat,
|
||||
probability,
|
||||
String.valueOf(MULTI_PATH_PAYMENT.fees().milliSatoshis()),
|
||||
MULTI_PATH_PAYMENT.getFeeRate(),
|
||||
List.of(new RouteDto(amountSat, List.of(CHANNEL_ID), probability, feesMilliSat)))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user