add "sourced" fees to fee report

This commit is contained in:
Carsten Otto
2021-11-30 13:26:41 +01:00
parent 75b17b6072
commit beca0a2aaa
14 changed files with 111 additions and 18 deletions

View File

@@ -127,7 +127,8 @@ public class ChannelController {
private FeeReportDto getFeeReportDto(ChannelId channelId) {
Coins earned = feeService.getEarnedFeesForChannel(channelId);
return new FeeReportDto(earned);
Coins sourced = feeService.getSourcedFeesForChannel(channelId);
return new FeeReportDto(earned, sourced);
}
private PoliciesDto getPoliciesForChannel(@Nullable LocalChannel channel) {

View File

@@ -110,7 +110,7 @@ public class NodeController {
}
private FeeReportDto getFeeReportDto(Pubkey pubkey) {
return new FeeReportDto(feeService.getEarnedFeesForPeer(pubkey));
return new FeeReportDto(feeService.getEarnedFeesForPeer(pubkey), feeService.getSourcedFeesForPeer(pubkey));
}
private List<ChannelId> toSortedList(Set<? extends Channel> channels) {

View File

@@ -2,8 +2,11 @@ package de.cotto.lndmanagej.controller.dto;
import de.cotto.lndmanagej.model.Coins;
public record FeeReportDto(String earned) {
public FeeReportDto(Coins earned) {
this(String.valueOf(earned.milliSatoshis()));
public record FeeReportDto(String earned, String sourced) {
public FeeReportDto(Coins earned, Coins sourced) {
this(
String.valueOf(earned.milliSatoshis()),
String.valueOf(sourced.milliSatoshis())
);
}
}