Skip to content

Commit

Permalink
few more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vesellov committed Apr 29, 2024
1 parent 4c0a5ed commit 4608753
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 12 deletions.
7 changes: 6 additions & 1 deletion bitdust/blockchain/bismuth_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ def worker(s_time):


class TCPHandler(socketserver.BaseRequestHandler):

def handle(self):
global new_diff
global node_ip
Expand All @@ -615,7 +616,11 @@ def handle(self):
peer_ip, peer_port = self.request.getpeername()

try:
data = connections.receive(self.request, 10)
try:
data = connections.receive(self.request, 10)
except:
data = ''
lg.warn('failed reading data from %r: %r' % (self.client_address, self.request))

# if _Debug:
# lg.args(_DebugLevel, data=data, peer_ip=peer_ip, peer_port=peer_port)
Expand Down
28 changes: 24 additions & 4 deletions bitdust/blockchain/blockchain_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def render_GET(self, request):
div_main_class='main blockchain',
div_main_body=src,
google_analytics='',
pre_footer=web_html_template.pre_footer % dict(basepath='https://%s/' % _ExplorerHost),
pre_footer='',
)
return strng.to_bin(html_src)

Expand Down Expand Up @@ -331,7 +331,7 @@ def render_GET(self, request):
div_main_class='main blockchain-transaction',
div_main_body=src,
google_analytics='',
pre_footer=web_html_template.pre_footer % dict(basepath='https://%s/' % _ExplorerHost),
pre_footer='',
)
return strng.to_bin(html_src)

Expand Down Expand Up @@ -360,7 +360,27 @@ def render_GET(self, request):
div_main_class='main blockchain-transaction',
div_main_body=src,
google_analytics='',
pre_footer=web_html_template.pre_footer % dict(basepath='https://%s/' % _ExplorerHost),
pre_footer='',
)
return strng.to_bin(html_src)

if not raw:
src += '<p align=center>invalid transaction ID</p>\n'
src += '</div>\n'
src += '</div>\n'
src += '</div>\n'
src += '</div>\n'
html_src = web_html_template.WEB_ROOT_TEMPLATE % dict(
title='BitDust blockchain explorer',
site_url='https://bitdust.io',
basepath='https://%s/' % _ExplorerHost,
wikipath='https://bitdust.io/wiki/',
idserverspath='https://identities.bitdust.io/',
blockchainpath='https://blockchain.bitdust.io/',
div_main_class='main blockchain-transaction',
div_main_body=src,
google_analytics='',
pre_footer='',
)
return strng.to_bin(html_src)

Expand Down Expand Up @@ -390,7 +410,7 @@ def render_GET(self, request):
div_main_class='main blockchain-transaction',
div_main_body=src,
google_analytics='',
pre_footer=web_html_template.pre_footer % dict(basepath='https://%s/' % _ExplorerHost),
pre_footer='',
)
return strng.to_bin(html_src)

Expand Down
3 changes: 2 additions & 1 deletion bitdust/customer/fire_hire.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
#------------------------------------------------------------------------------

_Debug = False
_DebugLevel = 14
_DebugLevel = 12

#------------------------------------------------------------------------------

Expand Down Expand Up @@ -223,6 +223,7 @@ def Destroy():


class FireHire(automat.Automat):

"""
This class implements all the functionality of the ``fire_hire()`` state
machine.
Expand Down
3 changes: 2 additions & 1 deletion bitdust/services/service_customer_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def start(self):
return True

def stop(self):
self.payment_loop.stop()
if self.payment_loop.running:
self.payment_loop.stop()
self.payment_loop = None
return True

Expand Down
6 changes: 4 additions & 2 deletions bitdust/services/service_supplier_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ def start(self):
return True

def stop(self):
self.accept_payments_loop.stop()
if self.accept_payments_loop.running:
self.accept_payments_loop.stop()
self.accept_payments_loop = None
self.sync_my_transactions_loop.stop()
if self.sync_my_transactions_loop.running:
self.sync_my_transactions_loop.stop()
self.sync_my_transactions_loop = None
return True

Expand Down
5 changes: 3 additions & 2 deletions bitdust/supplier/storage_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def accept_storage_payments():
tx = jsn.loads_text(local_fs.ReadTextFile(filepath))
int(tx['block_height'])
tx['operation']
float(tx['amount'])
except:
lg.exc()
continue
Expand All @@ -523,11 +524,11 @@ def accept_storage_payments():
continue
if customer_prefix not in my_storage_transactions:
my_storage_transactions[customer_prefix] = {
'total_amount': 0,
'total_amount': 0.0,
'transactions': [],
}
my_storage_transactions[customer_prefix]['transactions'].append(tx)
my_storage_transactions[customer_prefix]['total_amount'] += tx['amount']
my_storage_transactions[customer_prefix]['total_amount'] += float(tx['amount'])
for customer_idurl in contactsdb.customers():
contracts_list = list_customer_contracts(customer_idurl)
for contract_started_time in contracts_list.keys():
Expand Down
3 changes: 2 additions & 1 deletion bitdust/userid/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@


class identity(object):

"""
We are passed an XML version of an identity and make an Identity. Also can
construct an Identity by providing all fields. The fields is:
Expand Down Expand Up @@ -411,7 +412,7 @@ def unserialize(self, xmlsrc):
try:
doc = minidom.parseString(strng.to_bin(xmlsrc))
except:
lg.exc('xmlsrc=%r' % xmlsrc)
lg.warn('failed reading identity source from %d bytes' % len(strng.to_bin(xmlsrc)))
return
self.clear_data()
self.from_xmlobj(doc.documentElement)
Expand Down

0 comments on commit 4608753

Please sign in to comment.