Browse Source

Merge #226: fix crash on bad podle revelation

286d306 fix crash on bad podle revelation (undeath)
master
AdamISZ 7 years ago
parent
commit
f96c0f5200
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 12
      jmclient/jmclient/maker.py

12
jmclient/jmclient/maker.py

@ -10,7 +10,7 @@ import btc
from jmclient.configure import jm_single
from jmbase.support import get_log
from jmclient.support import (calc_cj_fee)
from jmclient.podle import verify_podle, PoDLE
from jmclient.podle import verify_podle, PoDLE, PoDLEError
from twisted.internet import task
jlog = get_log()
@ -43,13 +43,19 @@ class Maker(object):
"""Receives data on proposed transaction offer from daemon, verifies
commitment, returns necessary data to send ioauth message (utxos etc)
"""
#deserialize the commitment revelation
cr_dict = PoDLE.deserialize_revelation(cr)
#check the validity of the proof of discrete log equivalence
tries = jm_single().config.getint("POLICY", "taker_utxo_retries")
def reject(msg):
jlog.info("Counterparty commitment not accepted, reason: " + msg)
return (False,)
# deserialize the commitment revelation
try:
cr_dict = PoDLE.deserialize_revelation(cr)
except PoDLEError as e:
reason = repr(e)
return reject(reason)
if not verify_podle(str(cr_dict['P']), str(cr_dict['P2']), str(cr_dict['sig']),
str(cr_dict['e']), str(commitment),
index_range=range(tries)):

Loading…
Cancel
Save