Increase max mining fee (#551)

This commit is contained in:
Reckless_Satoshi 2023-05-05 19:44:18 +00:00 committed by GitHub
parent 3532d73ed5
commit daa1127cfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -586,9 +586,9 @@ class Logics:
target_conf=config("SUGGESTED_TARGET_CONF", cast=int, default=2), target_conf=config("SUGGESTED_TARGET_CONF", cast=int, default=2),
)["mining_fee_rate"] )["mining_fee_rate"]
# Hardcap mining fee suggested at 100 sats/vbyte # Hardcap mining fee suggested at 300 sats/vbyte
if suggested_mining_fee_rate > 100: if suggested_mining_fee_rate > 300:
suggested_mining_fee_rate = 100 suggested_mining_fee_rate = 300
onchain_payment.suggested_mining_fee_rate = max( onchain_payment.suggested_mining_fee_rate = max(
2.05, LNNode.estimate_fee(amount_sats=preliminary_amount)["mining_fee_rate"] 2.05, LNNode.estimate_fee(amount_sats=preliminary_amount)["mining_fee_rate"]
@ -720,24 +720,29 @@ class Logics:
return False, { return False, {
"bad_address": f"The mining fee is too low. Must be higher than {min_mining_fee_rate} Sat/vbyte" "bad_address": f"The mining fee is too low. Must be higher than {min_mining_fee_rate} Sat/vbyte"
} }
elif float(mining_fee_rate) > 100: elif float(mining_fee_rate) > 500:
return False, { return False, {
"bad_address": "The mining fee is too high, must be less than 100 Sats/vbyte" "bad_address": "The mining fee is too high, must be less than 500 Sats/vbyte"
} }
order.payout_tx.mining_fee_rate = float(mining_fee_rate) order.payout_tx.mining_fee_rate = float(mining_fee_rate)
# If not mining ee provider use backend's suggested fee rate # If not mining fee provider use backend's suggested fee rate
else: else:
order.payout_tx.mining_fee_rate = order.payout_tx.suggested_mining_fee_rate order.payout_tx.mining_fee_rate = order.payout_tx.suggested_mining_fee_rate
tx = order.payout_tx tx = order.payout_tx
tx.address = address tx.address = address
tx.mining_fee_sats = int(tx.mining_fee_rate * 200) tx.mining_fee_sats = int(tx.mining_fee_rate * 280)
tx.num_satoshis = num_satoshis tx.num_satoshis = num_satoshis
tx.sent_satoshis = int( tx.sent_satoshis = int(
float(tx.num_satoshis) float(tx.num_satoshis)
- float(tx.num_satoshis) * float(tx.swap_fee_rate) / 100 - float(tx.num_satoshis) * float(tx.swap_fee_rate) / 100
- float(tx.mining_fee_sats) - float(tx.mining_fee_sats)
) )
if float(tx.sent_satoshis) < 20_000:
return False, {
"bad_address": "The amount remaining after subtracting mining fee is close to dust limit."
}
tx.status = OnchainPayment.Status.VALID tx.status = OnchainPayment.Status.VALID
tx.save() tx.save()

View File

@ -35,9 +35,9 @@ export const OnchainPayoutForm = ({
const { t } = useTranslation(); const { t } = useTranslation();
const minMiningFee = 2; const minMiningFee = 2;
const maxMiningFee = 100; const maxMiningFee = 500;
const invalidFee = onchain.miningFee < minMiningFee || onchain.miningFee > maxMiningFee; const invalidFee = onchain.miningFee < minMiningFee || onchain.miningFee > maxMiningFee;
const costPerVByte = 200; const costPerVByte = 280;
const handleMiningFeeChange = (e) => { const handleMiningFeeChange = (e) => {
const miningFee = Number(e.target.value); const miningFee = Number(e.target.value);