Skip to content
This repository was archived by the owner on Mar 9, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions monero/backends/jsonrpc/daemon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import binascii
from datetime import datetime
from datetime import datetime, timezone
from decimal import Decimal
import ipaddress
import json
Expand Down Expand Up @@ -150,7 +150,7 @@ def mempool(self):
Transaction(
hash=tx["id_hash"],
fee=from_atomic(tx["fee"]),
timestamp=datetime.fromtimestamp(tx["receive_time"]),
timestamp=datetime.fromtimestamp(tx["receive_time"], timezone.utc),
blob=binascii.unhexlify(tx["tx_blob"]),
json=json.loads(tx["tx_json"]),
confirmations=0,
Expand Down Expand Up @@ -182,7 +182,7 @@ def block(self, bhash=None, height=None):
"blob": res["blob"],
"hash": bhdr["hash"],
"height": bhdr["height"],
"timestamp": datetime.fromtimestamp(bhdr["timestamp"]),
"timestamp": datetime.fromtimestamp(bhdr["timestamp"], timezone.utc),
"version": (bhdr["major_version"], bhdr["minor_version"]),
"difficulty": bhdr["difficulty"],
"nonce": bhdr["nonce"],
Expand Down Expand Up @@ -1577,7 +1577,9 @@ def _do_get_transactions(self, hashes, prune):
hash=tx["tx_hash"],
fee=from_atomic(fee) if fee else None,
height=None if tx["in_pool"] else tx["block_height"],
timestamp=datetime.fromtimestamp(tx["block_timestamp"])
timestamp=datetime.fromtimestamp(
tx["block_timestamp"], timezone.utc
)
if "block_timestamp" in tx
else None,
output_indices=tx["output_indices"]
Expand Down
6 changes: 3 additions & 3 deletions monero/backends/jsonrpc/wallet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import binascii
from datetime import datetime
from datetime import datetime, timezone
import json
import logging
import operator
Expand Down Expand Up @@ -231,7 +231,7 @@ def _paymentdict(self, data):
result = {
"payment_id": None if pid is None else PaymentID(pid),
"amount": from_atomic(data["amount"]),
"timestamp": datetime.fromtimestamp(data["timestamp"])
"timestamp": datetime.fromtimestamp(data["timestamp"], timezone.utc)
if "timestamp" in data
else None,
"note": data.get("note", None),
Expand All @@ -258,7 +258,7 @@ def _tx(self, data):
"fee": from_atomic(data["fee"]) if "fee" in data else None,
"key": data.get("key"),
"height": data.get("height", data.get("block_height")) or None,
"timestamp": datetime.fromtimestamp(data["timestamp"])
"timestamp": datetime.fromtimestamp(data["timestamp"], timezone.utc)
if "timestamp" in data
else None,
"blob": binascii.unhexlify(data.get("blob", "")),
Expand Down