Improve Dogecoin fee estimation to reduce overly high fees
The fee estimation was calculating ~/bin/bash.20 fees when it should be much lower. Changes: - Use 6 block target (~1 hour) instead of 2 blocks for cheaper estimates - Reduce transaction size estimate from 0.5KB to 0.25KB (more realistic for DOGE) - Lower fallback fee from 0.01 DOGE to 0.002 DOGE (~/bin/bash.0006 vs /bin/bash.003) - Update development.ini default to match new lower fallback This should reduce typical fee estimates from ~/bin/bash.20 to ~/bin/bash.02-0.05 range, making Dogecoin payments more cost-effective for users while still covering both inbound and sweep transaction costs.
This commit is contained in:
parent
2a3b007299
commit
e3bfb8e4f0
2 changed files with 10 additions and 7 deletions
|
|
@ -93,8 +93,8 @@ dogecoin.rpc_pass = ${MPS_DOGECOIN_RPC_PASS:-change_this_password_in_production}
|
|||
dogecoin.confirmations.petty = ${MPS_DOGECOIN_CONFIRMATIONS_PETTY:-2}
|
||||
dogecoin.confirmations.mid = ${MPS_DOGECOIN_CONFIRMATIONS_MID:-6}
|
||||
dogecoin.confirmations.high = ${MPS_DOGECOIN_CONFIRMATIONS_HIGH:-20}
|
||||
# Fee buffer for customer payments (in DOGE)
|
||||
dogecoin.fee_buffer = ${MPS_DOGECOIN_FEE_BUFFER:-0.01}
|
||||
# Fee buffer for customer payments (in DOGE) - reduced from 0.01 to 0.002 for more reasonable fees
|
||||
dogecoin.fee_buffer = ${MPS_DOGECOIN_FEE_BUFFER:-0.002}
|
||||
dogecoin.rate_source_url = ${MPS_DOGECOIN_RATE_SOURCE_URL:-https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies=usd}
|
||||
|
||||
# set this to the path of your private DKIM key.
|
||||
|
|
|
|||
|
|
@ -1094,20 +1094,23 @@ def estimate_dogecoin_fee_for_quote(settings):
|
|||
client = get_dogecoin_client_from_settings(settings)
|
||||
|
||||
# Use estimatesmartfee to get current network fee estimate
|
||||
fee_estimate_result = client._call("estimatesmartfee", [2]) # 2 block target
|
||||
# Use 6 block target (~1 hour) instead of 2 blocks for cheaper fees
|
||||
fee_estimate_result = client._call("estimatesmartfee", [6])
|
||||
if fee_estimate_result and "feerate" in fee_estimate_result:
|
||||
# feerate is in DOGE per KB, estimate transaction size as ~0.5KB
|
||||
estimated_fee_doge = float(fee_estimate_result["feerate"]) * 0.5
|
||||
# feerate is in DOGE per KB, estimate transaction size as ~0.25KB (more realistic)
|
||||
# Typical DOGE transaction is ~225 bytes, not 500 bytes
|
||||
estimated_fee_doge = float(fee_estimate_result["feerate"]) * 0.25
|
||||
# Double the fee to cover both inbound (customer) and outbound (sweep) transactions
|
||||
total_fee_doge = estimated_fee_doge * 2
|
||||
return Decimal(str(total_fee_doge))
|
||||
else:
|
||||
# Fallback to hardcoded fee if estimatesmartfee fails, doubled for inbound + outbound
|
||||
fallback_fee = float(settings.get("dogecoin.fee_buffer", "0.01")) * 2
|
||||
# Reduce fallback from 0.01 to 0.002 DOGE (~$0.0006 vs $0.003)
|
||||
fallback_fee = float(settings.get("dogecoin.fee_buffer", "0.002")) * 2
|
||||
return Decimal(str(fallback_fee))
|
||||
except Exception as e:
|
||||
# Fallback to hardcoded fee if RPC call fails, doubled for inbound + outbound
|
||||
fallback_fee = float(settings.get("dogecoin.fee_buffer", "0.01")) * 2
|
||||
fallback_fee = float(settings.get("dogecoin.fee_buffer", "0.002")) * 2
|
||||
return Decimal(str(fallback_fee))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue