Compare commits
2 Commits
fix/batch_
...
fix/balanc
| Author | SHA1 | Date | |
|---|---|---|---|
|
c4cd2bc443
|
|||
|
608933c228
|
21
account.py
21
account.py
@@ -45,9 +45,7 @@ if HSD_INTERNAL_NODE:
|
|||||||
HSD_API = "firewallet-" + str(int(time.time()))
|
HSD_API = "firewallet-" + str(int(time.time()))
|
||||||
HSD_IP = "localhost"
|
HSD_IP = "localhost"
|
||||||
|
|
||||||
SHOW_EXPIRED = os.getenv("SHOW_EXPIRED")
|
SHOW_EXPIRED = os.getenv("SHOW_EXPIRED","false").lower() in ["1","true","yes"]
|
||||||
if SHOW_EXPIRED is None:
|
|
||||||
SHOW_EXPIRED = False
|
|
||||||
|
|
||||||
HSD_PROCESS = None
|
HSD_PROCESS = None
|
||||||
SPV_MODE = None
|
SPV_MODE = None
|
||||||
@@ -368,7 +366,7 @@ def getBalance(account: str):
|
|||||||
available = available / 1000000
|
available = available / 1000000
|
||||||
logger.debug(f"Initial balance for account {account}: total={total}, available={available}, locked={locked}")
|
logger.debug(f"Initial balance for account {account}: total={total}, available={available}, locked={locked}")
|
||||||
|
|
||||||
domains = getDomains(account)
|
domains = getDomains(account,True,True)
|
||||||
domainValue = 0
|
domainValue = 0
|
||||||
domains_to_update = [] # Track domains that need cache updates
|
domains_to_update = [] # Track domains that need cache updates
|
||||||
|
|
||||||
@@ -475,22 +473,27 @@ def getPendingTX(account: str):
|
|||||||
return pending
|
return pending
|
||||||
|
|
||||||
|
|
||||||
def getDomains(account, own=True):
|
def getDomains(account, own: bool = True, expired: bool = SHOW_EXPIRED):
|
||||||
if own:
|
if own:
|
||||||
response = requests.get(get_wallet_api_url(f"/wallet/{account}/name?own=true"))
|
response = requests.get(get_wallet_api_url(f"/wallet/{account}/name?own=true"))
|
||||||
else:
|
else:
|
||||||
response = requests.get(get_wallet_api_url(f"/wallet/{account}/name"))
|
response = requests.get(get_wallet_api_url(f"/wallet/{account}/name"))
|
||||||
info = response.json()
|
info = response.json()
|
||||||
|
|
||||||
if SHOW_EXPIRED:
|
if expired:
|
||||||
return info
|
return info
|
||||||
|
|
||||||
# Remove any expired domains
|
# Remove any expired domains
|
||||||
domains = []
|
domains = []
|
||||||
for domain in info:
|
for domain in info:
|
||||||
if 'stats' in domain:
|
if 'stats' in domain and domain['stats'] is not None:
|
||||||
if 'daysUntilExpire' in domain['stats']:
|
if 'daysUntilExpire' in domain['stats']:
|
||||||
if domain['stats']['daysUntilExpire'] < 0:
|
if domain['stats']['daysUntilExpire'] < 0:
|
||||||
|
logger.debug(f"Excluding expired domain: {domain['name']} due to daysUntilExpire")
|
||||||
|
continue
|
||||||
|
if 'blocksSinceExpired' in domain['stats']:
|
||||||
|
if domain['stats']['blocksSinceExpired'] > 0:
|
||||||
|
logger.debug(f"Excluding expired domain: {domain['name']} due to blocksSinceExpired")
|
||||||
continue
|
continue
|
||||||
domains.append(domain)
|
domains.append(domain)
|
||||||
|
|
||||||
@@ -1573,9 +1576,9 @@ def getMempoolBids():
|
|||||||
|
|
||||||
|
|
||||||
# region settingsAPIs
|
# region settingsAPIs
|
||||||
def rescan():
|
def rescan(height:int = 0):
|
||||||
try:
|
try:
|
||||||
response = hsw.walletRescan(0)
|
response = hsw.walletRescan(height)
|
||||||
if 'success' in response and response['success'] is False:
|
if 'success' in response and response['success'] is False:
|
||||||
return {
|
return {
|
||||||
"error": {
|
"error": {
|
||||||
|
|||||||
Reference in New Issue
Block a user