Skip to content

Commit 6d82858

Browse files
committed
Merge #1053: Prevent amounts less than minsize being processed
16fa85b Prevent amounts less than minsize being processed (Adam Gibson)
2 parents ebd0464 + 16fa85b commit 6d82858

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

jmclient/jmclient/configure.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ def jm_single():
410410
cjfee_factor = 0.1
411411
412412
# [satoshis, any integer] / the average transaction fee you're adding to coinjoin transactions
413-
txfee_contribution = 100
413+
# (note: this will soon be deprecated; leave at zero)
414+
txfee_contribution = 0
414415
415416
# [fraction, 0-1] / variance around the average fee. Ex: 1000 fee, 0.2 var = fee is btw 800-1200
416417
txfee_contribution_factor = 0.3

jmclient/jmclient/maker.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ def verify_unsigned_tx(self, tx, offerinfo):
215215
my_total_in = sum([va['value'] for va in utxos.values()])
216216
real_cjfee = calc_cj_fee(ordertype, cjfee, amount)
217217
expected_change_value = (my_total_in - amount - txfee + real_cjfee)
218-
jlog.info('potentially earned = {}'.format(btc.amount_to_str(real_cjfee - txfee)))
218+
potentially_earned = real_cjfee - txfee
219+
if potentially_earned < 0:
220+
return (False, "A negative earning was calculated: {}.".format(
221+
potentially_earned))
222+
jlog.info('potentially earned = {}'.format(btc.amount_to_str(potentially_earned)))
219223
jlog.info('mycjaddr, mychange = {}, {}'.format(cjaddr, changeaddr))
220224

221225
#The remaining checks are needed to ensure

jmdaemon/jmdaemon/daemon_protocol.py

+2
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,11 @@ def on_order_fill(self, nick, oid, amount, taker_pk, commit):
771771
offer_s = [o for o in self.offerlist if o['oid'] == oid]
772772
if len(offer_s) == 0:
773773
self.mcc.send_error(nick, 'oid not found')
774+
return
774775
offer = offer_s[0]
775776
if amount < offer['minsize'] or amount > offer['maxsize']:
776777
self.mcc.send_error(nick, 'amount out of range')
778+
return
777779
#prepare a pubkey for this valid transaction
778780
kp = init_keypair()
779781
try:

0 commit comments

Comments
 (0)