Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,22 @@ func (api *api) GetInfo(ctx context.Context) (*InfoResponse, error) {
}

info.Network = nodeInfo.Network
switch backendType {
case config.LDKBackendType:
// Only LDK supports this right now. Using a local interface here
// so we don't have to bloat the main LNClient interface for everyone else.
type chainSourceProvider interface {
GetChainDataSource() (string, string)
}

if ldkService, ok := api.svc.GetLNClient().(chainSourceProvider); ok {
info.ChainDataSourceType, info.ChainDataSourceAddress = ldkService.GetChainDataSource()
}

case config.LNDBackendType:
info.ChainDataSourceType = "lnd"
info.ChainDataSourceAddress, _ = api.cfg.Get("LNDAddress", "")
}
}

info.NextBackupReminder, _ = api.cfg.Get("NextBackupReminder", "")
Expand Down
2 changes: 2 additions & 0 deletions api/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ type InfoResponse struct {
Relays []InfoResponseRelay `json:"relays"`
NodeAlias string `json:"nodeAlias"`
MempoolUrl string `json:"mempoolUrl"`
ChainDataSourceType string `json:"chainDataSourceType,omitempty"`
ChainDataSourceAddress string `json:"chainDataSourceAddress,omitempty"`
}

type UpdateSettingsRequest struct {
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/screens/settings/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ export function About() {
{info.backendType}
</p>
</div>
{info.chainDataSourceType && (
<div className="grid gap-2">
<p className="font-medium text-sm">Chain Data Source</p>
<div className="flex flex-col gap-1">
<p className="text-muted-foreground text-sm capitalize">
{info.chainDataSourceType}
</p>
{info.chainDataSourceAddress && (
<p className="text-muted-foreground text-xs font-mono break-all opacity-70">
{info.chainDataSourceAddress}
</p>
)}
</div>
</div>
)}
<div className="grid gap-2">
<p className="font-medium text-sm">Nostr Relays</p>
{info.relays.map((relay) => (
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export interface InfoResponse {
nodeAlias: string;
mempoolUrl: string;
bitcoinDisplayFormat: BitcoinDisplayFormat;
chainDataSourceType?: string;
chainDataSourceAddress?: string;
}

export type BitcoinDisplayFormat = "sats" | "bip177";
Expand Down
13 changes: 13 additions & 0 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -2511,3 +2511,16 @@ func (ls *LDKService) ConsumeEvent(ctx context.Context, event *events.Event, glo
ls.backupChannels()
}
}

func (ls *LDKService) GetChainDataSource() (string, string) {
if host := ls.cfg.GetEnv().LDKBitcoindRpcHost; host != "" {
return "bitcoind", host
}
if host := ls.cfg.GetEnv().LDKElectrumServer; host != "" {
return "electrum", host
}

// Fallback to Esplora
host := ls.cfg.GetEnv().LDKEsploraServer
return "esplora", host
}
Loading