Skip to content

Commit

Permalink
improve gs early exit message for invalid tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
jcramer committed Mar 23, 2021
1 parent 53534a5 commit a6d701f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions electroncash/slp_graph_search.py
Expand Up @@ -365,17 +365,23 @@ def search_query(self, job):
msg = 'message is too long'
raise Exception('server returned invalid json (%s)'%msg)
except KeyError:
if dat.get('message', None):
msg = dat['message']
if 'txid is missing from slp validity set' in msg:
raise Exception('likely invalid slp')
raise Exception(dat)

# NOTE: THE FOLLOWING IS FOR DEBUG PURPOSES TO CHECK
# THE GRAPH SEARCH RESULTS AGAINST ANOTHER VALIDATOR
# USING THE SAME TX DATA AND TXID CACHE.
#
# # save txdata and cache to file for debugging
# with open('%s-txdata.json'%job.root_txid, 'x') as json_file:
# json.dump(dat, json_file)
# with open('%s-cache.json'%job.root_txid, 'x') as json_file:
# json.dump({'cache': cache }, json_file)
# try:
# with open('%s-txdata.json'%job.root_txid, 'x') as json_file:
# json.dump(dat, json_file)
# with open('%s-cache.json'%job.root_txid, 'x') as json_file:
# json.dump({'cache': cache }, json_file)
# except: pass

for txn in txns:
job.txn_count_progress += 1
Expand Down

0 comments on commit a6d701f

Please sign in to comment.