Merge pull request #10436 from SomberNight/202601_fix_qt_address_tab_for_watchonly_imported
qt: fix: addresses tab broken for imported watchonly wallets
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
|
||||
import enum
|
||||
from enum import IntEnum
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from PyQt6.QtCore import Qt, QPersistentModelIndex, QModelIndex
|
||||
from PyQt6.QtGui import QStandardItemModel, QStandardItem, QFont
|
||||
@@ -244,8 +244,14 @@ class AddressList(MyTreeView):
|
||||
# update counter
|
||||
self.num_addr_label.setText(_("{} addresses").format(num_shown))
|
||||
|
||||
def address_index_as_sortable_key(self, address_index: 'AddressIndexGeneric'):
|
||||
return address_index if isinstance(address_index, str) else ''.join(f'{i:08x}' for i in address_index)
|
||||
@staticmethod
|
||||
def address_index_as_sortable_key(address_index: Optional['AddressIndexGeneric']) -> str:
|
||||
if isinstance(address_index, str): # pubkey hex
|
||||
return address_index
|
||||
elif address_index is None:
|
||||
return ""
|
||||
else:
|
||||
return "".join(f"{i:08x}" for i in address_index)
|
||||
|
||||
def refresh_row(self, key, row):
|
||||
assert row is not None
|
||||
|
||||
@@ -3784,7 +3784,10 @@ class Imported_Wallet(Simple_Wallet):
|
||||
return self.db.has_imported_address(address)
|
||||
|
||||
def get_address_index(self, address) -> Optional[str]:
|
||||
# returns None if address is not mine
|
||||
# Return pubkey for address if we know it.
|
||||
# If we don't know it, return None, which might happen:
|
||||
# - if address is not is_mine
|
||||
# - if this is an "imported address", we don't have the pubkey for. (watch-only imported wallet)
|
||||
return self.get_public_key(address)
|
||||
|
||||
def get_address_path_str(self, address):
|
||||
|
||||
Reference in New Issue
Block a user