Skip to content

Commit

Permalink
fix: resolve lh propose bootup
Browse files Browse the repository at this point in the history
  • Loading branch information
preethamr committed Oct 12, 2023
1 parent b170bd3 commit 8007a97
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/agents/lighthouse/src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const makeLighthouse = async (event?: any) => {
case "sendoutboundroot":
await makeSendOutboundRoot(config, chainData);
break;
case "proposer":
case "propose":
await makePropose(config, chainData);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const propose = async () => {

const latestSnapshotIds = [...new Map([...pendingSnapshotsById].sort().reverse()).keys()];
if (latestSnapshotIds.length === 0) {
logger.info("No pending snapshot roots found", requestContext, methodContext);
logger.info("No pending snapshot roots found. Nothing to propose", requestContext, methodContext);
return;
}
const latestSnapshotId = latestSnapshotIds[0];

Expand Down
4 changes: 4 additions & 0 deletions packages/agents/lighthouse/src/tasks/propose/propose.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChainReader, contractDeployments, getAmbABIs, getContractInterfaces } from "@connext/nxtp-txservice";
import { closeDatabase, getDatabase } from "@connext/nxtp-adapters-database";
import {
ChainData,
createLoggingContext,
Expand Down Expand Up @@ -46,6 +47,7 @@ export const makePropose = async (config: NxtpLighthouseConfig, chainData: Map<s
context.logger.child({ module: "ChainReader" }),
context.config.chains,
);
context.adapters.database = await getDatabase(context.config.database.url, context.logger);

context.adapters.relayers = [];
for (const relayerConfig of context.config.relayers) {
Expand Down Expand Up @@ -106,6 +108,8 @@ export const makePropose = async (config: NxtpLighthouseConfig, chainData: Map<s
}
} catch (e: unknown) {
console.error("Error starting Propose task. Sad! :(", e);
await closeDatabase();
process.exit();
} finally {
process.exit();
}
Expand Down

0 comments on commit 8007a97

Please sign in to comment.