mirror of
https://github.com/basicswap/basicswap.git
synced 2026-05-08 23:42:12 +02:00
refactor: simplify getAddressInfo
This commit is contained in:
+11
-17
@@ -939,32 +939,26 @@ class BTCInterface(Secp256k1Interface):
|
|||||||
if wm:
|
if wm:
|
||||||
info = wm.getAddressInfo(self.coin_type(), address)
|
info = wm.getAddressInfo(self.coin_type(), address)
|
||||||
if info:
|
if info:
|
||||||
if or_watch_only:
|
if or_watch_only is False and info["is_watch_only"] is True:
|
||||||
return True
|
return False
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
addr_info = self.rpc_wallet("getaddressinfo", [address])
|
addr_info = self.rpc_wallet("getaddressinfo", [address])
|
||||||
if not or_watch_only:
|
if addr_info["ismine"]:
|
||||||
if addr_info["ismine"]:
|
return True
|
||||||
return True
|
if or_watch_only is False:
|
||||||
else:
|
return False
|
||||||
if self._use_descriptors:
|
if addr_info["iswatchonly"]:
|
||||||
addr_info = self.rpc_wallet_watch("getaddressinfo", [address])
|
return True
|
||||||
if addr_info["ismine"] or addr_info["iswatchonly"]:
|
if self._use_descriptors:
|
||||||
|
wo_addr_info = self.rpc_wallet_watch("getaddressinfo", [address])
|
||||||
|
if wo_addr_info["iswatchonly"]:
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._log.debug(f"isAddressMine RPC check failed: {e}")
|
self._log.debug(f"isAddressMine RPC check failed: {e}")
|
||||||
|
|
||||||
wm = self.getWalletManager()
|
|
||||||
if wm:
|
|
||||||
info = wm.getAddressInfo(self.coin_type(), address)
|
|
||||||
if info:
|
|
||||||
if or_watch_only:
|
|
||||||
return True
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def checkAddressMine(self, address: str) -> None:
|
def checkAddressMine(self, address: str) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user