feat: show pending/in-flight payments for LDK Node in hourglass view
This commit is contained in:
@@ -469,6 +469,31 @@ export default class ChannelsStore {
|
||||
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
if (
|
||||
this.settingsStore.implementation === 'embedded-ldk-node' &&
|
||||
setPendingHtlcs
|
||||
) {
|
||||
try {
|
||||
const data = await BackendUtils.getPayments();
|
||||
const pendingPayments = (data?.payments || []).filter(
|
||||
(p: any) => p.status === 'IN_FLIGHT'
|
||||
);
|
||||
runInAction(() => {
|
||||
for (const p of pendingPayments) {
|
||||
this.pendingHTLCs.push({
|
||||
incoming: false,
|
||||
amount: p.value_sat || p.value || 0,
|
||||
hash_lock: p.payment_hash || '',
|
||||
expiration_height: 0
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('LDK Node: Failed to fetch pending payments', e);
|
||||
}
|
||||
}
|
||||
|
||||
return channels;
|
||||
};
|
||||
|
||||
|
||||
@@ -99,9 +99,13 @@ export default class PendingHTLCs extends React.PureComponent<
|
||||
const displayName = item.incoming
|
||||
? localeString('views.PendingHTLCs.incoming')
|
||||
: localeString('views.PendingHTLCs.outgoing');
|
||||
const subTitle = `${localeString(
|
||||
'views.PendingHTLCs.expirationHeight'
|
||||
)}: ${numberWithCommas(item.expiration_height)}`;
|
||||
const subTitle = item.expiration_height
|
||||
? `${localeString(
|
||||
'views.PendingHTLCs.expirationHeight'
|
||||
)}: ${numberWithCommas(
|
||||
item.expiration_height
|
||||
)}`
|
||||
: '';
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
||||
Reference in New Issue
Block a user