Skip to content

Commit 7b4b36a

Browse files
committed
Tolerate counterparties using the old DUST_THRESHOLD value
Specifically, if they're using anything above the network threshold, it's still acceptable; although we still prefer to use a higher floor when picking our own UTXOs. Lower floor is still used when retaining the last few satoshis, amounts below it are donated as miner fees. Fixes bug from e46cad9
1 parent 3276e3c commit 7b4b36a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

joinmarket/configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __getitem__(self, key):
5555
global_singleton.JM_VERSION = 5
5656
global_singleton.nickname = None
5757
global_singleton.BITCOIN_DUST_THRESHOLD = 2730
58-
global_singleton.DUST_THRESHOLD = 10 * global_singleton.BITCOIN_DUST_THRESHOLD
58+
global_singleton.DUST_THRESHOLD = 10 * global_singleton.BITCOIN_DUST_THRESHOLD
5959
global_singleton.bc_interface = None
6060
global_singleton.ordername_list = ['absoffer', 'reloffer']
6161
global_singleton.commitment_broadcast_list = ['hp2']

joinmarket/maker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, maker, nick, oid, amount, taker_pk):
2828
self.maker = maker
2929
self.oid = oid
3030
self.cj_amount = amount
31-
if self.cj_amount <= jm_single().DUST_THRESHOLD:
31+
if self.cj_amount <= jm_single().BITCOIN_DUST_THRESHOLD:
3232
self.maker.msgchan.send_error(nick, 'amount below dust threshold')
3333
# the btc pubkey of the utxo that the taker plans to use as input
3434
self.taker_pk = taker_pk

joinmarket/taker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def recv_txio(self, nick, utxo_list, auth_pub, cj_addr, change_addr):
181181
# inputs totalling less than the coinjoin amount! this leads to
182182
# a change output of zero satoshis, so the invalid transaction
183183
# fails harmlessly; let's fail earlier, with a clear message.
184-
if change_amount < jm_single().DUST_THRESHOLD:
184+
if change_amount < jm_single().BITCOIN_DUST_THRESHOLD:
185185
fmt = ('ERROR counterparty requires sub-dust change. No '
186186
'action required. nick={}'
187187
'totalin={:d} cjamount={:d} change={:d}').format
@@ -223,20 +223,20 @@ def recv_txio(self, nick, utxo_list, auth_pub, cj_addr, change_addr):
223223
my_change_value = (
224224
my_total_in - self.cj_amount - self.cjfee_total - my_txfee)
225225
#Since we could not predict the maker's inputs, we may end up needing
226-
#too much such that the change value is negative or small. Note that
226+
#too much such that the change value is negative or small. Note that
227227
#we have tried to avoid this based on over-estimating the needed amount
228228
#in SendPayment.create_tx(), but it is still a possibility if one maker
229229
#uses a *lot* of inputs.
230230
if self.my_change_addr and my_change_value <= 0:
231231
raise ValueError("Calculated transaction fee of: "+str(
232232
self.total_txfee)+" is too large for our inputs;Please try again.")
233-
elif self.my_change_addr and my_change_value <= jm_single().DUST_THRESHOLD:
233+
elif self.my_change_addr and my_change_value <= jm_single().BITCOIN_DUST_THRESHOLD:
234234
log.info("Dynamically calculated change lower than dust: "+str(
235235
my_change_value)+"; dropping.")
236236
self.my_change_addr = None
237237
my_change_value = 0
238238
log.info('fee breakdown for me totalin=%d my_txfee=%d makers_txfee=%d cjfee_total=%d => changevalue=%d'
239-
% (my_total_in, my_txfee, self.maker_txfee_contributions,
239+
% (my_total_in, my_txfee, self.maker_txfee_contributions,
240240
self.cjfee_total, my_change_value))
241241
if self.my_change_addr is None:
242242
if my_change_value != 0 and abs(my_change_value) != 1:
@@ -378,7 +378,7 @@ def push(self):
378378
log.debug('\n' + tx)
379379
self.txid = btc.txhash(tx)
380380
log.info('txid = ' + self.txid)
381-
381+
382382
tx_broadcast = jm_single().config.get('POLICY', 'tx_broadcast')
383383
if tx_broadcast == 'self':
384384
pushed = jm_single().bc_interface.pushtx(tx)

0 commit comments

Comments
 (0)