Skip to content

Commit 03dfd66

Browse files
committed
remove feereport
The current fees can also be determined using chan_info, which is pulled anyway. However, the fee report currently has performance issues, particularly with Postgres and many forwards. Therefore, it will be removed. See also lightningnetwork/lnd#9882
1 parent a218897 commit 03dfd66

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

charge_lnd/charge_lnd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ def main():
6868
if cb and is_defined(chp.circuitbreaker_params):
6969
cb.apply_params(chp.circuitbreaker_params, channel.remote_pubkey)
7070

71-
if channel.chan_id in lnd.feereport:
72-
(current_base_fee_msat, current_fee_ppm) = lnd.feereport[channel.chan_id]
73-
7471
chan_info = lnd.get_chan_info(channel.chan_id)
7572
if not chan_info:
7673
print ("could not lookup channel info for " + fmt.print_chanid(channel.chan_id).ljust(14) + ", skipping")
7774
continue
78-
75+
7976
my_policy = chan_info.node1_policy if chan_info.node1_pub == my_pubkey else chan_info.node2_policy
77+
78+
current_base_fee_msat = my_policy.fee_base_msat
79+
current_fee_ppm = my_policy.fee_rate_milli_msat
8080

8181
min_fee_ppm_delta = policy.getint('min_fee_ppm_delta',0)
8282

charge_lnd/lnd.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ def __init__(self, lnd_dir, server, tls_cert_path=None, macaroon_path=None):
149149
self.peer_channels = {}
150150
self.chan_metrics = {}
151151
self.peer_metrics = {}
152-
try:
153-
self.feereport = self.get_feereport()
154-
except grpc._channel._InactiveRpcError:
155-
self.valid = False
156152

157153
@staticmethod
158154
def get_credentials(lnd_dir, tls_cert_path, macaroon_path):
@@ -190,13 +186,6 @@ def get_synced_to_chain(self):
190186
time.sleep(1)
191187
return self.synced_to_chain
192188

193-
def get_feereport(self):
194-
feereport = self.lnstub.FeeReport(ln.FeeReportRequest())
195-
feedict = {}
196-
for channel_fee in feereport.channel_fees:
197-
feedict[channel_fee.chan_id] = (channel_fee.base_fee_msat, channel_fee.fee_per_mil)
198-
return feedict
199-
200189
# query the forwarding history for a channel covering the last # of seconds
201190
def get_forward_history(self, chanid, seconds):
202191
# cache all history to avoid stomping on lnd

0 commit comments

Comments
 (0)