Browse Source

Merge #954: fix overflow error on 32bit ARM

f9ea973be9 fix overflow error on 32bit ARM (openoms)

Pull request description:

  Fixes #953

  Tested on a 32bit Odroid running Armbian:
  `Linux odroidxu4 4.14.222-odroidxu4 #2 SMP PREEMPT armv7l GNU/Linux`

  based on #857 as suggested in https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/953#issuecomment-890519047

ACKs for top commit:
  kristapsk:
    re-ACK f9ea973be9

Tree-SHA512: a8c1e46c7350b8871f88a92b111b1d77c2ac817d6357da852c055849206bd53bbbf8b90000a88fc8198e85a3b7eaab48fc5970c80f5072d10a785632f72f704e
master
Kristaps Kaupe 4 years ago
parent
commit
72ebf95544
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  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