Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing: Forwarding history fixes #1347

Merged
merged 2 commits into from Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions stores/FeeStore.ts
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
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
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