From 876b0ff295a4eac36f3f71ab0425c41fceed25e4 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Tue, 14 Mar 2023 12:41:51 +0100 Subject: [PATCH] qml: handle empty histogram more gracefully, set histogram limit to 10MB --- electrum/gui/qml/qenetwork.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qml/qenetwork.py b/electrum/gui/qml/qenetwork.py index d32a93ac4..4caa44f07 100644 --- a/electrum/gui/qml/qenetwork.py +++ b/electrum/gui/qml/qenetwork.py @@ -95,7 +95,7 @@ class QENetwork(QObject, QtEventListener): def update_histogram(self, histogram): # cap the histogram to a limited number of megabytes - bytes_limit=25*1000*1000 + bytes_limit=10*1000*1000 bytes_current = 0 capped_histogram = [] for item in sorted(histogram, key=lambda x: x[0], reverse=True): @@ -109,8 +109,8 @@ class QENetwork(QObject, QtEventListener): self._fee_histogram = { 'histogram': capped_histogram, 'total': bytes_current, - 'min_fee': capped_histogram[-1][0], - 'max_fee': capped_histogram[0][0] + 'min_fee': capped_histogram[-1][0] if capped_histogram else FEERATE_DEFAULT_RELAY/1000, + 'max_fee': capped_histogram[0][0] if capped_histogram else FEERATE_DEFAULT_RELAY/1000 } self.feeHistogramUpdated.emit()