mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-21 14:04:03 +01:00
fix: catching getChannel callback error (#46)
catching FullChannelDetailsNotFound on the getChannel call we do using the lightning library, this seems to be a response we get if the channel edge is not found or is a zombie one. fixes https://github.com/apotdevin/thunderhub/issues/45
This commit is contained in:
parent
b23f8c2299
commit
caefd02234
2 changed files with 34 additions and 8 deletions
|
@ -54,10 +54,23 @@ export const getForwardChannelsReport = {
|
|||
}
|
||||
|
||||
const getNodeAlias = async (id: string, publicKey: string) => {
|
||||
const channelInfo: ChannelsProps = await getChannel({
|
||||
lnd,
|
||||
id,
|
||||
});
|
||||
let channelInfo: ChannelsProps;
|
||||
try {
|
||||
channelInfo = await getChannel({
|
||||
lnd,
|
||||
id,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error[1] == 'FullChannelDetailsNotFound') {
|
||||
return {
|
||||
alias: 'Edge Zombie or not found',
|
||||
color: '#000000',
|
||||
};
|
||||
}
|
||||
|
||||
logger.error('Error getting channel / node information: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
|
||||
const partnerPublicKey =
|
||||
channelInfo.policies[0].public_key !== publicKey
|
||||
|
|
|
@ -62,10 +62,23 @@ export const getForwards = {
|
|||
});
|
||||
|
||||
const getNodeAlias = async (id: string, publicKey: string) => {
|
||||
const channelInfo: ChannelsProps = await getChannel({
|
||||
lnd,
|
||||
id,
|
||||
});
|
||||
let channelInfo: ChannelsProps;
|
||||
try {
|
||||
channelInfo = await getChannel({
|
||||
lnd,
|
||||
id,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error[1] == 'FullChannelDetailsNotFound') {
|
||||
return {
|
||||
alias: 'Edge Zombie or not found',
|
||||
color: '#000000',
|
||||
};
|
||||
}
|
||||
|
||||
logger.error('Error getting channel / node information: %o', error);
|
||||
throw new Error(getErrorMsg(error));
|
||||
}
|
||||
|
||||
const partnerPublicKey =
|
||||
channelInfo.policies[0].public_key !== publicKey
|
||||
|
|
Loading…
Add table
Reference in a new issue