From c4042fdf4b6b0d86644653147105b5e9d0f63e1e Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 15 Sep 2025 22:06:25 +0200 Subject: [PATCH] Fix error message if no route found (#2534) --- api/lnd/index.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/api/lnd/index.js b/api/lnd/index.js index cc090688..e55d43d1 100644 --- a/api/lnd/index.js +++ b/api/lnd/index.js @@ -60,17 +60,11 @@ export async function estimateRouteFee ({ lnd, destination, tokens, mtokens, req timeout }, (err, res) => { if (err) { - if (res?.failure_reason) { - reject(new Error(`Unable to estimate route: ${res.failure_reason}`)) - } else { - reject(err) - } - return + return reject(err) } - if (res.routing_fee_msat < 0 || res.time_lock_delay <= 0) { - reject(new Error('Unable to estimate route, excessive values: ' + JSON.stringify(res))) - return + if (res.failure_reason !== 'FAILURE_REASON_NONE' || res.routing_fee_msat < 0 || res.time_lock_delay <= 0) { + return reject(new Error(`Unable to estimate route: ${res.failure_reason}`)) } resolve({