1
0

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:
ghost43
2026-01-23 17:51:36 +00:00
committed by GitHub
2 changed files with 13 additions and 4 deletions

View File

@@ -25,7 +25,7 @@
import enum import enum
from enum import IntEnum from enum import IntEnum
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Optional
from PyQt6.QtCore import Qt, QPersistentModelIndex, QModelIndex from PyQt6.QtCore import Qt, QPersistentModelIndex, QModelIndex
from PyQt6.QtGui import QStandardItemModel, QStandardItem, QFont from PyQt6.QtGui import QStandardItemModel, QStandardItem, QFont
@@ -244,8 +244,14 @@ class AddressList(MyTreeView):
# update counter # update counter
self.num_addr_label.setText(_("{} addresses").format(num_shown)) self.num_addr_label.setText(_("{} addresses").format(num_shown))
def address_index_as_sortable_key(self, address_index: 'AddressIndexGeneric'): @staticmethod
return address_index if isinstance(address_index, str) else ''.join(f'{i:08x}' for i in address_index) 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): def refresh_row(self, key, row):
assert row is not None assert row is not None

View File

@@ -3784,7 +3784,10 @@ class Imported_Wallet(Simple_Wallet):
return self.db.has_imported_address(address) return self.db.has_imported_address(address)
def get_address_index(self, address) -> Optional[str]: 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) return self.get_public_key(address)
def get_address_path_str(self, address): def get_address_path_str(self, address):