Skip to content

Commit

Permalink
Merge pull request #2036 from kaloudis/zeus-2028
Browse files Browse the repository at this point in the history
ZEUS-2028: Embedded LND: Neutrino peers: display all default peers
  • Loading branch information
kaloudis committed Mar 14, 2024
2 parents 14a9988 + 20cfb85 commit f4aec27
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 197 deletions.
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

0 comments on commit f4aec27

Please sign in to comment.