Browse Source

fix overflow error on 32bit ARM

based on #857 as discussed in #953
master
openoms 4 years ago
parent
commit
f9ea973be9
No known key found for this signature in database
GPG Key ID: 5BFB77609B081B65
  1. 2
      jmclient/jmclient/wallet.py
  2. 6
      jmclient/jmclient/wallet_utils.py
  3. 4
      scripts/obwatch/ob-watcher.py

2
jmclient/jmclient/wallet.py

@ -2273,7 +2273,7 @@ class FidelityBondMixin(object):
path = self.script_to_path(script) path = self.script_to_path(script)
if not self.is_timelocked_path(path): if not self.is_timelocked_path(path):
return return
if datetime.utcfromtimestamp(path[-1]) > datetime.now(): if (datetime.utcfromtimestamp(0) + timedelta(seconds=path[-1])) > datetime.now():
#freeze utxo if its timelock is in the future #freeze utxo if its timelock is in the future
self.disable_utxo(txid, index, disable=True) self.disable_utxo(txid, index, disable=True)

6
jmclient/jmclient/wallet_utils.py

@ -4,7 +4,7 @@ import json
import os import os
import sqlite3 import sqlite3
import sys import sys
from datetime import datetime from datetime import datetime, timedelta
from calendar import timegm from calendar import timegm
from optparse import OptionParser from optparse import OptionParser
from numbers import Integral from numbers import Integral
@ -378,7 +378,7 @@ def wallet_showutxos(wallet_service, showprivkey):
if showprivkey: if showprivkey:
unsp[us]['privkey'] = wallet_service.get_wif_path(av['path']) unsp[us]['privkey'] = wallet_service.get_wif_path(av['path'])
if locktime: if locktime:
unsp[us]["locktime"] = str(datetime.utcfromtimestamp(locktime)) unsp[us]["locktime"] = str(datetime.utcfromtimestamp(0) + timedelta(seconds=locktime))
used_commitments, external_commitments = podle.get_podle_commitments() used_commitments, external_commitments = podle.get_podle_commitments()
for u, ec in external_commitments.items(): for u, ec in external_commitments.items():
@ -477,7 +477,7 @@ def wallet_display(wallet_service, showprivkey, displayall=False,
for timenumber in range(FidelityBondMixin.TIMENUMBER_COUNT): for timenumber in range(FidelityBondMixin.TIMENUMBER_COUNT):
path = wallet_service.get_path(m, address_type, timenumber, timenumber) path = wallet_service.get_path(m, address_type, timenumber, timenumber)
addr = wallet_service.get_address_from_path(path) addr = wallet_service.get_address_from_path(path)
timelock = datetime.utcfromtimestamp(path[-1]) timelock = datetime.utcfromtimestamp(0) + timedelta(seconds=path[-1])
balance = sum([utxodata["value"] for utxo, utxodata in balance = sum([utxodata["value"] for utxo, utxodata in
utxos[m].items() if path == utxodata["path"]]) utxos[m].items() if path == utxodata["path"]])

4
scripts/obwatch/ob-watcher.py

@ -16,7 +16,7 @@ from future.moves.urllib.parse import parse_qs
from decimal import Decimal from decimal import Decimal
from optparse import OptionParser from optparse import OptionParser
from twisted.internet import reactor from twisted.internet import reactor
from datetime import datetime from datetime import datetime, timedelta
if sys.version_info < (3, 7): if sys.version_info < (3, 7):
print("ERROR: this script requires at least python 3.7") print("ERROR: this script requires at least python 3.7")
@ -352,7 +352,7 @@ class OrderbookPageRequestHeader(http.server.SimpleHTTPRequestHandler):
utxo_value_str = "No data" utxo_value_str = "No data"
else: else:
bond_value_str = satoshi_to_unit_power(bond_value, 2*unit_to_power[btc_unit]) bond_value_str = satoshi_to_unit_power(bond_value, 2*unit_to_power[btc_unit])
conf_time_str = str(datetime.utcfromtimestamp(conf_time)) conf_time_str = str(datetime.utcfromtimestamp(0) + timedelta(seconds=conf_time))
utxo_value_str = satoshi_to_unit(utxo_data["value"], None, btc_unit, 0) utxo_value_str = satoshi_to_unit(utxo_data["value"], None, btc_unit, 0)
bondtable += ("<tr>" bondtable += ("<tr>"
+ elem(bond_data.maker_nick) + elem(bond_data.maker_nick)

Loading…
Cancel
Save