don't bail if node is unannounced

This commit is contained in:
keyan 2023-12-23 14:27:01 -06:00
parent ac1c64e402
commit 6633b9f894
1 changed files with 7 additions and 1 deletions

View File

@ -445,12 +445,18 @@ export async function createWithdrawal (parent, { invoice, maxFee }, { me, model
let decoded, node
try {
decoded = await decodePaymentRequest({ lnd, request: invoice })
node = await getNode({ lnd, public_key: decoded.destination, is_omitting_channels: true })
} catch (error) {
console.log(error)
throw new GraphQLError('could not decode invoice', { extensions: { code: 'BAD_INPUT' } })
}
try {
node = await getNode({ lnd, public_key: decoded.destination, is_omitting_channels: true })
} catch (error) {
// likely not found if it's an unannounced channel, e.g. phoenix
console.log(error)
}
if (node) {
for (const { socket } of node.sockets) {
const ip = socket.split(':')[0]