persist completed payments

This commit is contained in:
Carsten Otto
2021-12-05 22:05:04 +01:00
parent 4e3d825c3c
commit 7964853037
46 changed files with 698 additions and 67 deletions

View File

@@ -95,7 +95,7 @@ public class ChannelController {
public BalanceInformationDto getBalance(@PathVariable ChannelId channelId) {
BalanceInformation balanceInformation = balanceService.getBalanceInformation(channelId)
.orElse(BalanceInformation.EMPTY);
return BalanceInformationDto.createFrom(balanceInformation);
return BalanceInformationDto.createFromModel(balanceInformation);
}
@Timed
@@ -122,7 +122,7 @@ public class ChannelController {
}
private FeeReportDto getFeeReportDto(ChannelId channelId) {
return FeeReportDto.createFrom(feeService.getFeeReportForChannel(channelId));
return FeeReportDto.createFromModel(feeService.getFeeReportForChannel(channelId));
}
private PoliciesDto getPoliciesForChannel(@Nullable LocalChannel channel) {
@@ -130,7 +130,7 @@ public class ChannelController {
return PoliciesDto.EMPTY;
}
Policies policies = policyService.getPolicies(channel.getId());
return PoliciesDto.createFrom(policies);
return PoliciesDto.createFromModel(policies);
}
private BalanceInformation getBalanceInformation(ChannelId channelId) {

View File

@@ -73,7 +73,7 @@ public class NodeController {
toSortedList(channelService.getWaitingCloseChannelsWith(pubkey)),
toSortedList(channelService.getForceClosingChannelsWith(pubkey)),
new OnChainCostsDto(openCosts, closeCosts),
BalanceInformationDto.createFrom(balanceInformation),
BalanceInformationDto.createFromModel(balanceInformation),
node.online(),
getFeeReportDto(pubkey)
);
@@ -96,7 +96,7 @@ public class NodeController {
@Timed
@GetMapping("/balance")
public BalanceInformationDto getBalance(@PathVariable Pubkey pubkey) {
return BalanceInformationDto.createFrom(balanceService.getBalanceInformationForPeer(pubkey));
return BalanceInformationDto.createFromModel(balanceService.getBalanceInformationForPeer(pubkey));
}
@Timed
@@ -106,7 +106,7 @@ public class NodeController {
}
private FeeReportDto getFeeReportDto(Pubkey pubkey) {
return FeeReportDto.createFrom(feeService.getFeeReportForPeer(pubkey));
return FeeReportDto.createFromModel(feeService.getFeeReportForPeer(pubkey));
}
private List<ChannelId> toSortedList(Set<? extends Channel> channels) {

View File

@@ -11,7 +11,7 @@ public record BalanceInformationDto(
String remoteReserve,
String remoteAvailable
) {
public static BalanceInformationDto createFrom(BalanceInformation balanceInformation) {
public static BalanceInformationDto createFromModel(BalanceInformation balanceInformation) {
return new BalanceInformationDto(
toString(balanceInformation.localBalance()),
toString(balanceInformation.localReserve()),

View File

@@ -46,7 +46,7 @@ public record ChannelDetailsDto(
channelDto.totalSent(),
channelDto.totalReceived(),
channelDto.status(),
BalanceInformationDto.createFrom(balanceInformation),
BalanceInformationDto.createFromModel(balanceInformation),
onChainCosts,
policies,
channelDto.closeDetails(),

View File

@@ -30,7 +30,7 @@ public record ChannelDto(
String.valueOf(localChannel.getCapacity().satoshis()),
String.valueOf(localChannel.getTotalSent().satoshis()),
String.valueOf(localChannel.getTotalReceived().satoshis()),
ChannelStatusDto.createFrom(localChannel.getStatus()),
ChannelStatusDto.createFromModel(localChannel.getStatus()),
localChannel.getOpenInitiator(),
closeDetails
);

View File

@@ -9,7 +9,7 @@ public record ChannelStatusDto(
boolean closed,
String openClosed
) {
public static ChannelStatusDto createFrom(ChannelStatus status) {
public static ChannelStatusDto createFromModel(ChannelStatus status) {
return new ChannelStatusDto(
status.privateChannel(),
status.active(),

View File

@@ -11,7 +11,7 @@ public record FeeReportDto(String earned, String sourced) {
);
}
public static FeeReportDto createFrom(FeeReport feeReport) {
public static FeeReportDto createFromModel(FeeReport feeReport) {
return new FeeReportDto(feeReport.earned(), feeReport.sourced());
}
}

View File

@@ -9,10 +9,10 @@ public record PoliciesDto(
public static final PoliciesDto EMPTY =
new PoliciesDto(PolicyDto.EMPTY, PolicyDto.EMPTY);
public static PoliciesDto createFrom(Policies policies) {
public static PoliciesDto createFromModel(Policies policies) {
return new PoliciesDto(
PolicyDto.createFrom(policies.local()),
PolicyDto.createFrom(policies.remote())
PolicyDto.createFromModel(policies.local()),
PolicyDto.createFromModel(policies.remote())
);
}
}

View File

@@ -14,7 +14,7 @@ public record PolicyDto(
false
);
public static PolicyDto createFrom(Policy policy) {
public static PolicyDto createFromModel(Policy policy) {
return new PolicyDto(
policy.feeRate(),
policy.baseFee().milliSatoshis(),