mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-25 00:44:22 +01:00
get channel IDs for open channels in compact format
This commit is contained in:
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/legacy")
|
||||
@@ -52,13 +53,18 @@ public class LegacyController {
|
||||
|
||||
@GetMapping("/open-channels")
|
||||
public String getOpenChannelIds() {
|
||||
return channelService.getOpenChannels().stream()
|
||||
.map(Channel::getId)
|
||||
.sorted()
|
||||
return getOpenChannelIdsSorted()
|
||||
.map(ChannelId::toString)
|
||||
.collect(Collectors.joining(NEWLINE));
|
||||
}
|
||||
|
||||
@GetMapping("/open-channels/compact")
|
||||
public String getOpenChannelIdsCompact() {
|
||||
return getOpenChannelIdsSorted()
|
||||
.map(ChannelId::getCompactForm)
|
||||
.collect(Collectors.joining(NEWLINE));
|
||||
}
|
||||
|
||||
@GetMapping("/peer-pubkeys")
|
||||
public String getPeerPubkeys() {
|
||||
return channelService.getOpenChannels().stream()
|
||||
@@ -93,4 +99,10 @@ public class LegacyController {
|
||||
public long getOutgoingBaseFee(@PathVariable ChannelId channelId) {
|
||||
return feeService.getOutgoingBaseFee(channelId).milliSatoshis();
|
||||
}
|
||||
|
||||
private Stream<ChannelId> getOpenChannelIdsSorted() {
|
||||
return channelService.getOpenChannels().stream()
|
||||
.map(Channel::getId)
|
||||
.sorted();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user