Skip to content

Commit

Permalink
Add envvars for target_conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Mar 18, 2023
1 parent 9158bd4 commit 7fdbebb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,14 @@ MIN_SWAP_POINT = 0.35
MAX_SWAP_FEE = 0.1
# Liquidity split point (LN/onchain) at which we use MAX_SWAP_FEE
MAX_SWAP_POINT = 0
# Min amount allowed for Swap
# Min and Max amount allowed for Swap
MIN_SWAP_AMOUNT = 10000
MAX_SWAP_AMOUNT = 1000000
# Spend Unconfirmed UTXOS (more capital efficient, more risky)
SPEND_UNCONFIRMED = False
# Mining fee confirmation target
SUGGESTED_TARGET_CONF = 4
MINIMUM_TARGET_CONF = 24

# Reward tip. Reward for every finished trade in the referral program (Satoshis)
REWARD_TIP = 100
Expand Down
6 changes: 4 additions & 2 deletions api/logics.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ def create_onchain_payment(cls, order, user, preliminary_amount):
return False

suggested_mining_fee_rate = LNNode.estimate_fee(
amount_sats=preliminary_amount, target_conf=2
amount_sats=preliminary_amount,
target_conf=config("SUGGESTED_TARGET_CONF", cast=int, default=2),
)["mining_fee_rate"]

# Hardcap mining fee suggested at 100 sats/vbyte
Expand Down Expand Up @@ -698,7 +699,8 @@ def update_address(cls, order, user, address, mining_fee_rate):
if mining_fee_rate:
# not a valid mining fee
min_mining_fee_rate = LNNode.estimate_fee(
amount_sats=num_satoshis, target_conf=12
amount_sats=num_satoshis,
target_conf=config("MINIMUM_TARGET_CONF", cast=int, default=24),
)["mining_fee_rate"]

min_mining_fee_rate = max(2, min_mining_fee_rate)
Expand Down

0 comments on commit 7fdbebb

Please sign in to comment.