Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channels: fixed aliases #2532

Merged
merged 1 commit into from
Nov 15, 2024
Merged
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
17 changes: 14 additions & 3 deletions stores/ChannelsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ export enum ChannelsType {
Closed = 2
}

interface aliases {
[index: string]: string;
}

const fixedAliases: aliases = {
'031b301307574bbe9b9ac7b79cbe1700e31e544513eae0b5d7497483083f99e581':
'Olympus by ZEUS'
};

export default class ChannelsStore {
@observable public loading = false;
@observable public error = false;
Expand Down Expand Up @@ -338,15 +347,17 @@ export default class ChannelsStore {

for (const channel of channelsWithMissingAliases) {
const nodeInfo = this.nodes[channel.remotePubkey];
if (!nodeInfo) continue;
this.aliasesById[channel.channelId!] = nodeInfo.alias;
const alias = nodeInfo?.alias || fixedAliases[channel.remotePubkey];
if (alias) this.aliasesById[channel.channelId!] = alias;
}

if (setPendingHtlcs) this.pendingHTLCs = [];

for (const channel of channels) {
if (channel.alias == null) {
channel.alias = this.nodes[channel.remotePubkey]?.alias;
channel.alias =
this.nodes[channel.remotePubkey]?.alias ||
this.aliasesById[channel.channelId!];
}
channel.displayName =
channel.alias ||
Expand Down
Loading