diff --git a/lightning-commons/lightning-commons-client-cln/src/main/java/org/tbk/lightning/client/common/cln/ClnCommonClient.java b/lightning-commons/lightning-commons-client-cln/src/main/java/org/tbk/lightning/client/common/cln/ClnCommonClient.java index 8b03760f4..e963c2782 100644 --- a/lightning-commons/lightning-commons-client-cln/src/main/java/org/tbk/lightning/client/common/cln/ClnCommonClient.java +++ b/lightning-commons/lightning-commons-client-cln/src/main/java/org/tbk/lightning/client/common/cln/ClnCommonClient.java @@ -12,6 +12,7 @@ import java.util.HexFormat; import java.util.List; +import java.util.Optional; /** * See: CLN API Docs @@ -41,6 +42,10 @@ public Mono info(CommonInfoRequest request) { .setNetwork(response.getNetwork()) .build()) .setBlockheight(response.getBlockheight()) + .setWarningBlockSync(Optional.of(response.getWarningBitcoindSync()) + .filter(it -> !it.isBlank()) + .or(() -> Optional.of(response.getWarningLightningdSync()).filter(it -> !it.isBlank())) + .orElse("")) .build(); }); } diff --git a/lightning-commons/lightning-commons-client-core/src/main/java/org/tbk/lightning/client/common/core/core.proto b/lightning-commons/lightning-commons-client-core/src/main/java/org/tbk/lightning/client/common/core/core.proto index e1ff906ee..51887ec2a 100644 --- a/lightning-commons/lightning-commons-client-core/src/main/java/org/tbk/lightning/client/common/core/core.proto +++ b/lightning-commons/lightning-commons-client-core/src/main/java/org/tbk/lightning/client/common/core/core.proto @@ -24,6 +24,8 @@ message CommonInfoResponse { // A list of active chains the node is connected to repeated Chain chain = 9 [json_name = "chains"]; uint32 blockheight = 10 [json_name = "blockheight"]; + // a warning if either bitcoin or lightning node is not yet synced to chain; can be empty. + string warning_block_sync = 11 [json_name = "warning_block_sync"]; } message Chain { diff --git a/lightning-commons/lightning-commons-client-lnd/src/main/java/org/tbk/lightning/client/common/lnd/LndCommonClient.java b/lightning-commons/lightning-commons-client-lnd/src/main/java/org/tbk/lightning/client/common/lnd/LndCommonClient.java index d63c311c1..39c39f7f9 100644 --- a/lightning-commons/lightning-commons-client-lnd/src/main/java/org/tbk/lightning/client/common/lnd/LndCommonClient.java +++ b/lightning-commons/lightning-commons-client-lnd/src/main/java/org/tbk/lightning/client/common/lnd/LndCommonClient.java @@ -72,6 +72,7 @@ public Mono info(CommonInfoRequest request) { .build()) .toList()) .setBlockheight(response.getBlockHeight()) + .setWarningBlockSync(response.getSyncedToChain() ? "" : "Node is not synced to chain") .build(); }); }