From 8b7ad32d77f361f5c53f246753688bd3e57526ec Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Thu, 15 Jul 2021 20:43:22 +0200 Subject: [PATCH] logs --- utils/lightningServices/channelRequests.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/lightningServices/channelRequests.js b/utils/lightningServices/channelRequests.js index 18d3ae1e..0d54c521 100644 --- a/utils/lightningServices/channelRequests.js +++ b/utils/lightningServices/channelRequests.js @@ -6,11 +6,13 @@ const { listPeers, connectPeer,getInfo } = require('./v2') const handlerBaseUrl = "https://channels.shock.network:4444" module.exports = async () => { + console.log("DOING CHANNEL INVITE THING: START") /** * @type string | undefined */ const invite = process.env.HOSTING_INVITE if(!invite) { + console.log("DOING CHANNEL INVITE THING: NVM NO INVITE") return } try { @@ -19,17 +21,17 @@ module.exports = async () => { */ const invites = await Storage.getItem('processedInvites') || [] if(invites.includes(invite)){ + console.log("DOING CHANNEL INVITE THING: INVITE PROCESSED ALREADY") return } - const me = await getInfo() const {identity_pubkey} = me //@ts-expect-error const connectReq = await fetch(`${handlerBaseUrl}/connect`) if(connectReq.status !== 200 ){ + console.log("DOING CHANNEL INVITE THING: CONNECT FAILED") return } - const connJson = await connectReq.json() const [uri] = connJson.uris const [pub,host] = uri.split("@") @@ -51,13 +53,15 @@ module.exports = async () => { body:JSON.stringify(channelReq) }) if(res.status !== 200 ){ + console.log("DOING CHANNEL INVITE THING: FAILED ") return } invites.push(invite) await Storage.setItem('processedInvites',invites) - + console.log("DOING CHANNEL INVITE THING: DONE!") } catch(e){ logger.error("error sending invite to channels handler") + console.log("DOING CHANNEL INVITE THING: :(") console.error(e) }