|
|
|
|
@ -742,7 +742,6 @@ class Taker(object):
|
|
|
|
|
return priv_utxo_pairs, too_old, too_small |
|
|
|
|
|
|
|
|
|
commit_type_byte = "P" |
|
|
|
|
podle_data = None |
|
|
|
|
tries = jm_single().config.getint("POLICY", "taker_utxo_retries") |
|
|
|
|
age = jm_single().config.getint("POLICY", "taker_utxo_age") |
|
|
|
|
#Minor rounding errors don't matter here |
|
|
|
|
@ -751,24 +750,11 @@ class Taker(object):
|
|
|
|
|
"taker_utxo_amtpercent") / 100.0) |
|
|
|
|
priv_utxo_pairs, to, ts = priv_utxo_pairs_from_utxos(self.input_utxos, |
|
|
|
|
age, amt) |
|
|
|
|
#Note that we ignore the "too old" and "too small" lists in the first |
|
|
|
|
#pass through, because the same utxos appear in the whole-wallet check. |
|
|
|
|
|
|
|
|
|
#For podle data format see: podle.PoDLE.reveal() |
|
|
|
|
#In first round try, don't use external commitments |
|
|
|
|
podle_data = generate_podle(priv_utxo_pairs, tries) |
|
|
|
|
if not podle_data: |
|
|
|
|
#We defer to a second round to try *all* utxos in wallet; |
|
|
|
|
#this is because it's much cleaner to use the utxos involved |
|
|
|
|
#in the transaction, about to be consumed, rather than use |
|
|
|
|
#random utxos that will persist after. At this step we also |
|
|
|
|
#allow use of external utxos in the json file. |
|
|
|
|
if any(self.wallet_service.get_utxos_by_mixdepth().values()): |
|
|
|
|
utxos = {} |
|
|
|
|
for mdutxo in self.wallet_service.get_utxos_by_mixdepth().values(): |
|
|
|
|
utxos.update(mdutxo) |
|
|
|
|
priv_utxo_pairs, to, ts = priv_utxo_pairs_from_utxos( |
|
|
|
|
utxos, age, amt) |
|
|
|
|
#Pre-filter the set of external commitments that work for this |
|
|
|
|
#transaction according to its size and age. |
|
|
|
|
dummy, extdict = get_podle_commitments() |
|
|
|
|
@ -777,7 +763,18 @@ class Taker(object):
|
|
|
|
|
list(extdict.keys()), age, amt) |
|
|
|
|
else: |
|
|
|
|
ext_valid = None |
|
|
|
|
podle_data = generate_podle(priv_utxo_pairs, tries, ext_valid) |
|
|
|
|
#We defer to a second round to try *all* utxos in spending mixdepth; |
|
|
|
|
#this is because it's much cleaner to use the utxos involved |
|
|
|
|
#in the transaction, about to be consumed, rather than use |
|
|
|
|
#random utxos that will persist after. At this step we also |
|
|
|
|
#allow use of external utxos in the json file. |
|
|
|
|
mixdepth_utxos = self.wallet_service.get_utxos_by_mixdepth()[self.mixdepth] |
|
|
|
|
if len(self.input_utxos) == len(mixdepth_utxos): |
|
|
|
|
# Already tried the whole mixdepth |
|
|
|
|
podle_data = generate_podle([], tries, ext_valid) |
|
|
|
|
else: |
|
|
|
|
priv_utxo_pairs, to, ts = priv_utxo_pairs_from_utxos(mixdepth_utxos, age, amt) |
|
|
|
|
podle_data = generate_podle(priv_utxo_pairs, tries, ext_valid) |
|
|
|
|
if podle_data: |
|
|
|
|
jlog.debug("Generated PoDLE: " + repr(podle_data)) |
|
|
|
|
return (commit_type_byte + bintohex(podle_data.commitment), |
|
|
|
|
|