Skip to content

Commit

Permalink
Merge pull request #1347 from kaloudis/forwarding-history-fix
Browse files Browse the repository at this point in the history
Routing: Forwarding history fixes
  • Loading branch information
kaloudis authored Mar 3, 2023
2 parents 9b1aac3 + f9c8d5c commit aab4a6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
7 changes: 4 additions & 3 deletions stores/FeeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class FeeStore {
@observable public dataFrame: any = {};
@observable public recommendedFees: any = {};
@observable public loading = false;
@observable public loadingFees = false;
@observable public error = false;
@observable public setFeesError = false;
@observable public setFeesErrorMsg: string;
Expand Down Expand Up @@ -64,12 +65,12 @@ export default class FeeStore {

resetFees = () => {
this.fees = {};
this.loading = false;
this.loadingFees = false;
};

@action
public getFees = () => {
this.loading = true;
this.loadingFees = true;
BackendUtils.getFees()
.then((data: any) => {
if (data.channel_fees) {
Expand All @@ -87,7 +88,7 @@ export default class FeeStore {
// Deprecated in LND
// Used in c-lightning-REST
this.totalEarned = data.total_fee_sum || 0;
this.loading = false;
this.loadingFees = false;
})
.catch((err: any) => {
console.log('error getting fee report', err);
Expand Down
7 changes: 4 additions & 3 deletions views/Routing/Routing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class Routing extends React.PureComponent<
const { FeeStore } = this.props;
FeeStore.getFees();
if (BackendUtils.isLNDBased()) {
FeeStore.getForwardingHistory();
FeeStore.getForwardingHistory(HOURS[0]);
}
}

Expand Down Expand Up @@ -85,10 +85,11 @@ export default class Routing extends React.PureComponent<
earnedDuringTimeframe,
forwardingEvents,
forwardingHistoryError,
getForwardingHistory,
loading
getForwardingHistory
} = FeeStore;

const loading = FeeStore.loading || FeeStore.loadingFees;

const headerString =
forwardingEvents.length > 0
? `${localeString('general.routing')} (${
Expand Down
12 changes: 0 additions & 12 deletions views/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { themeColor } from './../../utils/ThemeUtils';

import BalanceStore from './../../stores/BalanceStore';
import ChannelsStore from './../../stores/ChannelsStore';
import FeeStore from './../../stores/FeeStore';

import FiatStore from './../../stores/FiatStore';
import NodeInfoStore from './../../stores/NodeInfoStore';
Expand All @@ -56,7 +55,6 @@ interface WalletProps {
navigation: any;
BalanceStore: BalanceStore;
ChannelsStore: ChannelsStore;
FeeStore: FeeStore;
NodeInfoStore: NodeInfoStore;
SettingsStore: SettingsStore;
UnitsStore: UnitsStore;
Expand All @@ -74,7 +72,6 @@ interface WalletState {
'BalanceStore',
'ChannelsStore',
'NodeInfoStore',
'FeeStore',
'SettingsStore',
'UnitsStore',
'FiatStore',
Expand Down Expand Up @@ -216,7 +213,6 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
NodeInfoStore,
BalanceStore,
ChannelsStore,
FeeStore,
UTXOsStore,
SettingsStore,
PosStore,
Expand Down Expand Up @@ -258,9 +254,6 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
await BalanceStore.getCombinedBalance();
if (BackendUtils.supportsChannelManagement())
ChannelsStore.getChannels();
if (BackendUtils.supportsRouting()) FeeStore.getFees();
if (BackendUtils.supportsRouting())
FeeStore.getForwardingHistory();
}
} else {
NodeInfoStore.getNodeInfo();
Expand All @@ -270,11 +263,6 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {

await BalanceStore.getCombinedBalance();
ChannelsStore.getChannels();
FeeStore.getFees();
}

if (implementation === 'lnd') {
FeeStore.getForwardingHistory();
}

if (connecting) {
Expand Down

0 comments on commit aab4a6e

Please sign in to comment.