XMR: display block count and timestamp in tracking wallet views

This commit is contained in:
The MMGen Project 2026-11-15 10:56:44 +00:00
commit dea1de85f5
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 26 additions and 5 deletions

View file

@ -1 +1 @@
17.0.0
17.1.0dev0

View file

@ -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')

View file

@ -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):