add convenience method

This commit is contained in:
Carsten Otto
2022-03-27 00:10:35 +01:00
parent ed40279805
commit 73e9ce20f2
3 changed files with 7 additions and 1 deletions

View File

@@ -2,4 +2,8 @@ package de.cotto.lndmanagej.model;
public record Policy(long feeRate, Coins baseFee, boolean enabled) {
public static final Policy UNKNOWN = new Policy(0, Coins.NONE, false);
public boolean disabled() {
return !enabled;
}
}

View File

@@ -20,11 +20,13 @@ class PolicyTest {
@Test
void enabled() {
assertThat(POLICY_1.enabled()).isTrue();
assertThat(POLICY_1.disabled()).isFalse();
}
@Test
void disabled() {
assertThat(POLICY_DISABLED.enabled()).isFalse();
assertThat(POLICY_DISABLED.disabled()).isTrue();
}
@Test

View File

@@ -71,7 +71,7 @@ public class FlowComputation {
Set<EdgeWithLiquidityInformation> edgesWithLiquidityInformation = new LinkedHashSet<>();
Pubkey ownPubkey = grpcGetInfo.getPubkey();
for (DirectedChannelEdge channelEdge : channelEdges) {
if (!channelEdge.policy().enabled()) {
if (channelEdge.policy().disabled()) {
continue;
}
ChannelId channelId = channelEdge.channelId();