mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-25 17:04:22 +01:00
add remote pubkey and alias to channel details
This commit is contained in:
@@ -4,7 +4,9 @@ import com.codahale.metrics.MetricRegistry;
|
||||
import de.cotto.lndmanagej.metrics.Metrics;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.LocalChannel;
|
||||
import de.cotto.lndmanagej.model.Pubkey;
|
||||
import de.cotto.lndmanagej.service.ChannelService;
|
||||
import de.cotto.lndmanagej.service.NodeService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -14,10 +16,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/api/channel/{channelId}")
|
||||
public class ChannelDetailsController {
|
||||
private final ChannelService channelService;
|
||||
private final NodeService nodeService;
|
||||
private final Metrics metrics;
|
||||
|
||||
public ChannelDetailsController(ChannelService channelService, Metrics metrics) {
|
||||
public ChannelDetailsController(ChannelService channelService, NodeService nodeService, Metrics metrics) {
|
||||
this.channelService = channelService;
|
||||
this.nodeService = nodeService;
|
||||
this.metrics = metrics;
|
||||
}
|
||||
|
||||
@@ -28,6 +32,8 @@ public class ChannelDetailsController {
|
||||
if (localChannel == null) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
return new ChannelDetailsDto(localChannel.getId());
|
||||
Pubkey remotePubkey = localChannel.getRemotePubkey();
|
||||
String remoteAlias = nodeService.getAlias(remotePubkey);
|
||||
return new ChannelDetailsDto(localChannel.getId(), remotePubkey, remoteAlias);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user