qml: handle empty histogram more gracefully, set histogram limit to 10MB
This commit is contained in:
@@ -95,7 +95,7 @@ class QENetwork(QObject, QtEventListener):
|
|||||||
|
|
||||||
def update_histogram(self, histogram):
|
def update_histogram(self, histogram):
|
||||||
# cap the histogram to a limited number of megabytes
|
# cap the histogram to a limited number of megabytes
|
||||||
bytes_limit=25*1000*1000
|
bytes_limit=10*1000*1000
|
||||||
bytes_current = 0
|
bytes_current = 0
|
||||||
capped_histogram = []
|
capped_histogram = []
|
||||||
for item in sorted(histogram, key=lambda x: x[0], reverse=True):
|
for item in sorted(histogram, key=lambda x: x[0], reverse=True):
|
||||||
@@ -109,8 +109,8 @@ class QENetwork(QObject, QtEventListener):
|
|||||||
self._fee_histogram = {
|
self._fee_histogram = {
|
||||||
'histogram': capped_histogram,
|
'histogram': capped_histogram,
|
||||||
'total': bytes_current,
|
'total': bytes_current,
|
||||||
'min_fee': capped_histogram[-1][0],
|
'min_fee': capped_histogram[-1][0] if capped_histogram else FEERATE_DEFAULT_RELAY/1000,
|
||||||
'max_fee': capped_histogram[0][0]
|
'max_fee': capped_histogram[0][0] if capped_histogram else FEERATE_DEFAULT_RELAY/1000
|
||||||
}
|
}
|
||||||
self.feeHistogramUpdated.emit()
|
self.feeHistogramUpdated.emit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user