diff --git a/development.ini b/development.ini index 68c182c..8a5c5c5 100644 --- a/development.ini +++ b/development.ini @@ -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. diff --git a/make_post_sell/views/crypto.py b/make_post_sell/views/crypto.py index 91fbfb4..ab4c672 100644 --- a/make_post_sell/views/crypto.py +++ b/make_post_sell/views/crypto.py @@ -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))