diff --git a/jmclient/jmclient/wallet.py b/jmclient/jmclient/wallet.py index 39e21c5..24c74f3 100644 --- a/jmclient/jmclient/wallet.py +++ b/jmclient/jmclient/wallet.py @@ -2273,7 +2273,7 @@ class FidelityBondMixin(object): path = self.script_to_path(script) if not self.is_timelocked_path(path): 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 self.disable_utxo(txid, index, disable=True) diff --git a/jmclient/jmclient/wallet_utils.py b/jmclient/jmclient/wallet_utils.py index ed1b2a1..111ce6e 100644 --- a/jmclient/jmclient/wallet_utils.py +++ b/jmclient/jmclient/wallet_utils.py @@ -4,7 +4,7 @@ import json import os import sqlite3 import sys -from datetime import datetime +from datetime import datetime, timedelta from calendar import timegm from optparse import OptionParser from numbers import Integral @@ -378,7 +378,7 @@ def wallet_showutxos(wallet_service, showprivkey): if showprivkey: unsp[us]['privkey'] = wallet_service.get_wif_path(av['path']) 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() 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): path = wallet_service.get_path(m, address_type, timenumber, timenumber) 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 utxos[m].items() if path == utxodata["path"]]) diff --git a/scripts/obwatch/ob-watcher.py b/scripts/obwatch/ob-watcher.py index fe6cf7e..91406d2 100755 --- a/scripts/obwatch/ob-watcher.py +++ b/scripts/obwatch/ob-watcher.py @@ -16,7 +16,7 @@ from future.moves.urllib.parse import parse_qs from decimal import Decimal from optparse import OptionParser from twisted.internet import reactor -from datetime import datetime +from datetime import datetime, timedelta if sys.version_info < (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" else: 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) bondtable += ("" + elem(bond_data.maker_nick)