Skip to content

Commit ccc3098

Browse files
authored
Merge pull request #783 from vesellov/master
built new service_blockchain_explorer()
2 parents 51540a1 + cebbb4e commit ccc3098

21 files changed

+924
-102
lines changed

.style.yapf

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ based_on_style=facebook
33
column_limit=240
44
indent_width=4
55
continuation_indent_width=4
6+
blank_line_before_class_docstring=True
7+
blank_line_before_nested_class_or_def=True
68
blank_lines_around_top_level_definition=2
79
blank_lines_between_top_level_imports_and_variables=1
810
no_spaces_around_selected_binary_operators=*,/

bitdust/blockchain/bismuth_miner.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import socks
66
import hashlib
77
import random
8-
import traceback
98

109
#------------------------------------------------------------------------------
1110

@@ -95,11 +94,8 @@ def check_start_mining():
9594
global _OwnCoinsLastTime
9695
global _WantMoreCoins
9796
global _MiningIsOn
98-
try:
99-
cur_balance = bismuth_wallet.my_balance()
100-
except:
101-
traceback.print_exc()
102-
cur_balance = 'N/A'
97+
98+
cur_balance = bismuth_wallet.my_balance()
10399

104100
lg.info('my wallet address is %s and current balance is %s' % (bismuth_wallet.my_wallet_address(), cur_balance))
105101
if _Debug:
@@ -108,11 +104,7 @@ def check_start_mining():
108104
if cur_balance == 'N/A':
109105
reactor.callLater(10, check_start_mining) # @UndefinedVariable
110106
return
111-
try:
112-
cur_balance = float(cur_balance)
113-
except:
114-
reactor.callLater(10, check_start_mining) # @UndefinedVariable
115-
return
107+
116108
if _WantMoreCoins and (not _OwnCoinsLastTime or (time.time() - _OwnCoinsLastTime > 60)):
117109
_OwnCoinsLastTime = time.time()
118110
_WantMoreCoins = False

bitdust/blockchain/bismuth_node.py

+1
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ def check_db_for_bootstrap(node):
521521

522522

523523
class CustomLogHandler(logging.Handler):
524+
524525
def emit(self, record):
525526
try:
526527
if _Debug:

bitdust/blockchain/bismuth_wallet.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,24 @@ def my_wallet_address():
125125

126126

127127
def my_balance():
128-
return client().balance()
128+
try:
129+
_balance = float(client().balance())
130+
except:
131+
lg.exc()
132+
return 'N/A'
133+
return _balance
129134

130135

131136
def latest_transactions(num, offset, for_display, mempool_included):
132137
return client().latest_transactions(num, offset, for_display, mempool_included)
133138

134139

135-
def send_transaction(recipient, amount, operation='', data=''):
140+
def send_transaction(recipient, amount, operation='', data='', raise_errors=False):
136141
error_reply = []
137142
ret = client().send(recipient=recipient, amount=amount, operation=operation, data=data, error_reply=error_reply)
138143
if not ret:
144+
if raise_errors:
145+
raise Exception(error_reply)
139146
return error_reply
140147
return ret
141148

0 commit comments

Comments
 (0)