|
|
|
@ -188,8 +188,8 @@ class Taker(object): |
|
|
|
self.cjamount = round_to_significant_figures(self.cjamount, |
|
|
|
self.cjamount = round_to_significant_figures(self.cjamount, |
|
|
|
rounding) |
|
|
|
rounding) |
|
|
|
if self.cjamount < jm_single().mincjamount: |
|
|
|
if self.cjamount < jm_single().mincjamount: |
|
|
|
jlog.info("Coinjoin amount too low, bringing up to: " + str( |
|
|
|
jlog.info("Coinjoin amount too low, bringing up to: " + |
|
|
|
jm_single().mincjamount)) |
|
|
|
btc.amount_to_str(jm_single().mincjamount)) |
|
|
|
self.cjamount = jm_single().mincjamount |
|
|
|
self.cjamount = jm_single().mincjamount |
|
|
|
self.n_counterparties = si[2] |
|
|
|
self.n_counterparties = si[2] |
|
|
|
self.my_cj_addr = si[3] |
|
|
|
self.my_cj_addr = si[3] |
|
|
|
@ -303,7 +303,7 @@ class Taker(object): |
|
|
|
self.total_txfee = estimate_tx_fee(3, 2, |
|
|
|
self.total_txfee = estimate_tx_fee(3, 2, |
|
|
|
txtype=self.wallet_service.get_txtype()) * self.n_counterparties |
|
|
|
txtype=self.wallet_service.get_txtype()) * self.n_counterparties |
|
|
|
total_amount = self.cjamount + self.total_cj_fee + self.total_txfee |
|
|
|
total_amount = self.cjamount + self.total_cj_fee + self.total_txfee |
|
|
|
jlog.info('total estimated amount spent = ' + str(total_amount)) |
|
|
|
jlog.info('total estimated amount spent = ' + btc.amount_to_str(total_amount)) |
|
|
|
try: |
|
|
|
try: |
|
|
|
self.input_utxos = self.wallet_service.select_utxos(self.mixdepth, total_amount, |
|
|
|
self.input_utxos = self.wallet_service.select_utxos(self.mixdepth, total_amount, |
|
|
|
minconfs=1) |
|
|
|
minconfs=1) |
|
|
|
@ -465,8 +465,10 @@ class Taker(object): |
|
|
|
estimated_fee = estimate_tx_fee( |
|
|
|
estimated_fee = estimate_tx_fee( |
|
|
|
len(sum(self.utxos.values(), [])), len(self.outputs) + 2, |
|
|
|
len(sum(self.utxos.values(), [])), len(self.outputs) + 2, |
|
|
|
txtype=self.wallet_service.get_txtype()) |
|
|
|
txtype=self.wallet_service.get_txtype()) |
|
|
|
jlog.info("Based on initial guess: " + str(self.total_txfee) + |
|
|
|
jlog.info("Based on initial guess: " + |
|
|
|
", we estimated a miner fee of: " + str(estimated_fee)) |
|
|
|
btc.amount_to_str(self.total_txfee) + |
|
|
|
|
|
|
|
", we estimated a miner fee of: " + |
|
|
|
|
|
|
|
btc.amount_to_str(estimated_fee)) |
|
|
|
#reset total |
|
|
|
#reset total |
|
|
|
self.total_txfee = estimated_fee |
|
|
|
self.total_txfee = estimated_fee |
|
|
|
my_txfee = max(self.total_txfee - self.maker_txfee_contributions, 0) |
|
|
|
my_txfee = max(self.total_txfee - self.maker_txfee_contributions, 0) |
|
|
|
@ -478,13 +480,13 @@ class Taker(object): |
|
|
|
#in SendPayment.create_tx(), but it is still a possibility if one maker |
|
|
|
#in SendPayment.create_tx(), but it is still a possibility if one maker |
|
|
|
#uses a *lot* of inputs. |
|
|
|
#uses a *lot* of inputs. |
|
|
|
if self.my_change_addr and my_change_value <= 0: |
|
|
|
if self.my_change_addr and my_change_value <= 0: |
|
|
|
raise ValueError("Calculated transaction fee of: " + str( |
|
|
|
raise ValueError("Calculated transaction fee of: " + |
|
|
|
self.total_txfee) + |
|
|
|
btc.amount_to_str(self.total_txfee) + |
|
|
|
" is too large for our inputs;Please try again.") |
|
|
|
" is too large for our inputs; Please try again.") |
|
|
|
elif self.my_change_addr and my_change_value <= jm_single( |
|
|
|
elif self.my_change_addr and my_change_value <= jm_single( |
|
|
|
).BITCOIN_DUST_THRESHOLD: |
|
|
|
).BITCOIN_DUST_THRESHOLD: |
|
|
|
jlog.info("Dynamically calculated change lower than dust: " + str( |
|
|
|
jlog.info("Dynamically calculated change lower than dust: " + |
|
|
|
my_change_value) + "; dropping.") |
|
|
|
btc.amount_to_str(my_change_value) + "; dropping.") |
|
|
|
self.my_change_addr = None |
|
|
|
self.my_change_addr = None |
|
|
|
my_change_value = 0 |
|
|
|
my_change_value = 0 |
|
|
|
jlog.info( |
|
|
|
jlog.info( |
|
|
|
@ -497,7 +499,7 @@ class Taker(object): |
|
|
|
# rounding so 1 satoshi extra or fewer being spent as miner |
|
|
|
# rounding so 1 satoshi extra or fewer being spent as miner |
|
|
|
# fees is acceptable |
|
|
|
# fees is acceptable |
|
|
|
jlog.info(('WARNING CHANGE NOT BEING ' |
|
|
|
jlog.info(('WARNING CHANGE NOT BEING ' |
|
|
|
'USED\nCHANGEVALUE = {}').format(my_change_value)) |
|
|
|
'USED\nCHANGEVALUE = {}').format(btc.amount_to_str(my_change_value))) |
|
|
|
else: |
|
|
|
else: |
|
|
|
self.outputs.append({'address': self.my_change_addr, |
|
|
|
self.outputs.append({'address': self.my_change_addr, |
|
|
|
'value': my_change_value}) |
|
|
|
'value': my_change_value}) |
|
|
|
|