Skip to content

Commit

Permalink
fix token validity issue in daemon mode #205
Browse files Browse the repository at this point in the history
  • Loading branch information
My Name committed May 14, 2021
1 parent 21232bf commit 3819046
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion electroncash/slp_graph_search.py
Expand Up @@ -365,7 +365,7 @@ def search_query(self, job):
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("maybe invalid slp (gs returned: 'txid is missing from slp validity set')")
raise Exception(dat)

# NOTE: THE FOLLOWING IS FOR DEBUG PURPOSES TO CHECK
Expand Down
6 changes: 4 additions & 2 deletions electroncash/slp_validator_0x01.py
Expand Up @@ -208,7 +208,9 @@ def fetch_hook(txids, val_job):

def done_callback(job):

if not wallet_ref:
# make sure the wallet is still allocated
wallet = wallet_ref()
if wallet is None:
return

# wait for proxy stuff to roll in
Expand All @@ -230,7 +232,7 @@ def done_callback(job):
for t,n in job.nodes.items():
val = n.validity
if val != 0:
wallet_ref().slpv1_validity[t] = val
wallet.slpv1_validity[t] = val

# get transaction block height
height = wallet.verified_tx.get(txid, (-1,None,None))[0]
Expand Down
8 changes: 8 additions & 0 deletions electroncash/slp_validator_0x01_nft1.py
Expand Up @@ -146,7 +146,15 @@ def fetch_hook(txids, val_job):

return l

wallet_ref = weakref.ref(wallet)

def done_callback(job):

# make sure the wallet is still allocated
wallet = wallet_ref()
if wallet is None:
return

# wait for proxy stuff to roll in
results = {}
try:
Expand Down
5 changes: 2 additions & 3 deletions electroncash/wallet.py
Expand Up @@ -1851,12 +1851,11 @@ def slp_check_validation(self, tx_hash, tx):
is_new = False
if tti['validity'] == 0 and tti['token_id'] in self.token_types and not is_new and tti['type'] in ['SLP1','SLP65','SLP129']:
def callback(job):
if slp_gs_mgr.slp_validity_signal == None:
return
(txid,node), = job.nodes.items()
val = node.validity
tti['validity'] = val
slp_gs_mgr.slp_validity_signal.emit(txid, val)
if slp_gs_mgr.slp_validity_signal is not None:
slp_gs_mgr.slp_validity_signal.emit(txid, val)

if tti['type'] == 'SLP1':
job = self.slp_graph_0x01.make_job(tx, self, self.network,
Expand Down

0 comments on commit 3819046

Please sign in to comment.