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

ZEUS-2028: Embedded LND: Neutrino peers: display all default peers #2036

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
29 changes: 27 additions & 2 deletions stores/SettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export interface Settings {
resetExpressGraphSyncOnStartup: boolean;
bimodalPathfinding: boolean;
dontAllowOtherPeers: boolean;
neutrinoPeers: Array<string>;
neutrinoPeersMainnet: Array<string>;
neutrinoPeersTestnet: Array<string>;
zeroConfPeers: Array<string>;
rescan: boolean;
compactDb: boolean;
Expand Down Expand Up @@ -924,6 +925,20 @@ export const TIME_PERIOD_KEYS = [
{ key: 'Weeks', translateKey: 'time.weeks', value: 'Weeks' }
];

export const DEFAULT_NEUTRINO_PEERS_MAINNET = [
'btcd1.lnolymp.us',
'btcd2.lnolymp.us',
'btcd-mainnet.lightning.computer',
'node.eldamar.icu',
'noad.sathoarder.com'
];

export const DEFAULT_NEUTRINO_PEERS_TESTNET = [
'testnet.lnolymp.us',
'btcd-testnet.lightning.computer',
'testnet.blixtwallet.com'
];

const STORAGE_KEY = 'zeus-settings';

export default class SettingsStore {
Expand Down Expand Up @@ -991,7 +1006,8 @@ export default class SettingsStore {
resetExpressGraphSyncOnStartup: false,
bimodalPathfinding: true,
dontAllowOtherPeers: true,
neutrinoPeers: [],
neutrinoPeersMainnet: DEFAULT_NEUTRINO_PEERS_MAINNET,
neutrinoPeersTestnet: DEFAULT_NEUTRINO_PEERS_TESTNET,
zeroConfPeers: [],
rescan: false,
compactDb: false,
Expand Down Expand Up @@ -1267,6 +1283,15 @@ export default class SettingsStore {
this.settings.pos.squareEnabled = false;
}

if (!this.settings.neutrinoPeersMainnet) {
this.settings.neutrinoPeersMainnet =
DEFAULT_NEUTRINO_PEERS_MAINNET;
}
if (!this.settings.neutrinoPeersTestnet) {
this.settings.neutrinoPeersTestnet =
DEFAULT_NEUTRINO_PEERS_TESTNET;
}

const node: any =
this.settings.nodes?.length &&
this.settings.nodes[this.settings.selectedNode || 0];
Expand Down
25 changes: 7 additions & 18 deletions utils/LndMobileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,6 @@ const writeLndConfig = async (
? 'connect'
: 'addpeer';

const peerDefaults = `neutrino.${peerMode}=${
isTestnet
? 'btcd-testnet.lightning.computer'
: 'btcd-mainnet.lightning.computer'
}
${!isTestnet ? `neutrino.${peerMode}=btcd1.lnolymp.us` : ''}
${!isTestnet ? `neutrino.${peerMode}=btcd2.lnolymp.us` : ''}
${!isTestnet ? `neutrino.${peerMode}=node.eldamar.icu` : ''}
${!isTestnet ? `neutrino.${peerMode}=noad.sathoarder.com` : ''}
${isTestnet ? `neutrino.${peerMode}=testnet.lnolymp.us` : ''}
${isTestnet ? `neutrino.${peerMode}=testnet.blixtwallet.com` : ''}`;

const config = `[Application Options]
debuglevel=info
maxbackoff=2s
Expand Down Expand Up @@ -114,12 +102,13 @@ const writeLndConfig = async (

[Neutrino]
${
stores.settingsStore?.settings?.neutrinoPeers &&
stores.settingsStore?.settings?.neutrinoPeers.length > 0
? stores.settingsStore?.settings?.neutrinoPeers.map(
(peer) => `neutrino.${peerMode}=${peer}`
)
: peerDefaults
!isTestnet
? stores.settingsStore?.settings?.neutrinoPeersMainnet
.map((peer) => `neutrino.${peerMode}=${peer}\n `)
.join('')
: stores.settingsStore?.settings?.neutrinoPeersTestnet
.map((peer) => `neutrino.${peerMode}=${peer}\n `)
.join('')
}
${
!isTestnet
Expand Down
Loading
Loading