From dea1de85f58cc1829c41f22fb2d6cb4433c7556e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 15 Nov 2026 10:56:44 +0000 Subject: [PATCH] XMR: display block count and timestamp in tracking wallet views --- mmgen/data/version | 2 +- mmgen/proto/xmr/tw/view.py | 15 +++++++++++---- mmgen/xmrwallet/ops/dump.py | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/mmgen/data/version b/mmgen/data/version index aac58983..027f3ea6 100644 --- a/mmgen/data/version +++ b/mmgen/data/version @@ -1 +1 @@ -17.0.0 +17.1.0dev0 diff --git a/mmgen/proto/xmr/tw/view.py b/mmgen/proto/xmr/tw/view.py index 03c30d70..26d07859 100644 --- a/mmgen/proto/xmr/tw/view.py +++ b/mmgen/proto/xmr/tw/view.py @@ -14,7 +14,7 @@ import asyncio from collections import namedtuple from ....obj import ImmutableAttr, Int -from ....util import msg, ymsg, suf +from ....util import msg, ymsg, suf, cached_property from ....color import red, green from ....addr import MoneroIdx from ....amt import CoinAmtChk @@ -50,9 +50,14 @@ class MoneroTwView: is_used = ImmutableAttr(bool) al_id = ImmutableAttr(str) - class rpc: - caps = () - is_remote = False + @cached_property + def rpc(self): + class DummyRPC: + caps = () + is_remote = False + blockcount = self.blockcount + cur_date = self.timestamp + return DummyRPC async def get_rpc_data(self, refresh=False): from mmgen.tw.shared import TwMMGenID, TwLabel @@ -73,6 +78,8 @@ class MoneroTwView: if dump_data: self.sid = SeedID(sid=dump_data[0]['seed_id']) + self.blockcount = Int(dump_data[0]['blockcount']) + self.timestamp = dump_data[0]['timestamp'] self.al_id = self.sid + ':M' self.total = self.unlocked_total = self.proto.coin_amt('0') diff --git a/mmgen/xmrwallet/ops/dump.py b/mmgen/xmrwallet/ops/dump.py index a99d34c2..7b8c0280 100644 --- a/mmgen/xmrwallet/ops/dump.py +++ b/mmgen/xmrwallet/ops/dump.py @@ -41,9 +41,23 @@ class OpDumpDataCommon(OpWallet): h = MoneroWalletRPC(self, d) h.open_wallet('source', refresh=not self.wallet_offline) + if (height := self.c.call('get_height')['height']) > 1: + from requests.exceptions import ConnectionError + blockcount = height - 1 + dc = self.get_coin_daemon_rpc(test_connection=False) + try: + timestamp = dc.call('getblock', height=blockcount)['block_header']['timestamp'] + except ConnectionError: + timestamp = None + else: + blockcount = 0 + timestamp = None + return { 'seed_id': self.kal.al_id.sid, 'wallet_num': d.idx, + 'blockcount': blockcount, + 'timestamp': timestamp, 'data': h.get_wallet_data(print=False)} def post_main_success(self):