Skip to content

Commit

Permalink
Merge #1053: Prevent amounts less than minsize being processed
Browse files Browse the repository at this point in the history
16fa85b Prevent amounts less than minsize being processed (Adam Gibson)
  • Loading branch information
AdamISZ committed Oct 20, 2021
2 parents ebd0464 + 16fa85b commit 6d82858
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion jmclient/jmclient/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ def jm_single():
cjfee_factor = 0.1
# [satoshis, any integer] / the average transaction fee you're adding to coinjoin transactions
txfee_contribution = 100
# (note: this will soon be deprecated; leave at zero)
txfee_contribution = 0
# [fraction, 0-1] / variance around the average fee. Ex: 1000 fee, 0.2 var = fee is btw 800-1200
txfee_contribution_factor = 0.3
Expand Down
6 changes: 5 additions & 1 deletion jmclient/jmclient/maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ def verify_unsigned_tx(self, tx, offerinfo):
my_total_in = sum([va['value'] for va in utxos.values()])
real_cjfee = calc_cj_fee(ordertype, cjfee, amount)
expected_change_value = (my_total_in - amount - txfee + real_cjfee)
jlog.info('potentially earned = {}'.format(btc.amount_to_str(real_cjfee - txfee)))
potentially_earned = real_cjfee - txfee
if potentially_earned < 0:
return (False, "A negative earning was calculated: {}.".format(
potentially_earned))
jlog.info('potentially earned = {}'.format(btc.amount_to_str(potentially_earned)))
jlog.info('mycjaddr, mychange = {}, {}'.format(cjaddr, changeaddr))

#The remaining checks are needed to ensure
Expand Down
2 changes: 2 additions & 0 deletions jmdaemon/jmdaemon/daemon_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,11 @@ def on_order_fill(self, nick, oid, amount, taker_pk, commit):
offer_s = [o for o in self.offerlist if o['oid'] == oid]
if len(offer_s) == 0:
self.mcc.send_error(nick, 'oid not found')
return
offer = offer_s[0]
if amount < offer['minsize'] or amount > offer['maxsize']:
self.mcc.send_error(nick, 'amount out of range')
return
#prepare a pubkey for this valid transaction
kp = init_keypair()
try:
Expand Down

0 comments on commit 6d82858

Please sign in to comment.