Skip to content

Commit 20a6b32

Browse files
committed
fix: handle /snapshots on health check
1 parent eb53049 commit 20a6b32

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/store/shapes/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const initialSettingsState: TSettings = {
103103
selectedCurrency: getDefaultCurrency(),
104104
selectedLanguage: 'english',
105105
customElectrumPeers: defaultElectrumPeer,
106-
rapidGossipSyncUrl: 'https://rgs.blocktank.to/snapshots/',
106+
rapidGossipSyncUrl: 'https://rgs.blocktank.to/snapshot/',
107107
coinSelectAuto: true,
108108
coinSelectPreference: ECoinSelectPreference.small,
109109
receivePreference: defaultReceivePreference,

src/utils/lightning/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,15 @@ export const checkRgsHealth = async (): Promise<
260260
Result<{ isHealthy: boolean; timestamp: number; ageHours: number }>
261261
> => {
262262
try {
263-
const rgsUrl = getStore().settings.rapidGossipSyncUrl;
263+
const rgsBaseUrl = getStore().settings.rapidGossipSyncUrl;
264+
265+
// Convert /snapshot/ to /snapshots/ for directory listing
266+
// LDK uses /snapshot/<timestamp> but we need /snapshots/ to list all snapshots
267+
const listingUrl = rgsBaseUrl.replace('/snapshot/', '/snapshots/');
264268

265269
// Fetch the RGS directory listing to find latest snapshot
266270
// @ts-ignore - fetch is available globally in React Native
267-
const response: any = await promiseTimeout(5000, fetch(rgsUrl));
271+
const response: any = await promiseTimeout(5000, fetch(listingUrl));
268272

269273
if (!response.ok) {
270274
return err(`RGS endpoint returned status ${response.status}`);

0 commit comments

Comments
 (0)