Fix error message if no route found (#2534)

This commit is contained in:
ekzyis 2025-09-15 22:06:25 +02:00 committed by GitHub
parent d9d0ba2903
commit c4042fdf4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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({