Skip to content

Commit dbccd73

Browse files
committed
various dashboard fixes
1 parent 3af9e46 commit dbccd73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

otsserver/rpc.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,17 @@ def do_GET(self):
157157
# need to investigate further, but this seems to work.
158158
str_wallet_balance = str(proxy._call("getbalance"))
159159

160-
transactions = proxy._call("listtransactions", "", 50)
160+
transactions = proxy._call("listtransactions", "", 1000)
161161
# We want only the confirmed txs containing an OP_RETURN, from most to least recent
162162
transactions = list(filter(lambda x: x["confirmations"] > 0 and x["amount"] == 0, transactions))
163163
a_week_ago = (datetime.date.today() - datetime.timedelta(days=7)).timetuple()
164164
a_week_ago_posix = time.mktime(a_week_ago)
165165
transactions_in_last_week = list(filter(lambda x: x["time"] > a_week_ago_posix, transactions))
166166
fees_in_last_week = reduce(lambda a,b: a-b["fee"], transactions_in_last_week, 0)
167-
time_between_transactions = round(168 / len(transactions_in_last_week)) # in hours based on 168 hours in a week
167+
try:
168+
time_between_transactions = round(168 / len(transactions_in_last_week)) # in hours based on 168 hours in a week
169+
except ZeroDivisionError:
170+
time_between_transactions = "Infinite"
168171
transactions.sort(key=lambda x: x["confirmations"])
169172
homepage_template = """<html>
170173
<head>

0 commit comments

Comments
 (0)