From 06e64072599e34c8c7e5df2fcb2a991b3eee3a50 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 27 Feb 2024 13:48:48 -0600 Subject: [PATCH] Revert "remove temporary doge fee hackfix" This reverts commit f67c9e64020b61149a7b1fd144f658f92d7e2dd6. --- lib/electrumx_rpc/electrumx_client.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/electrumx_rpc/electrumx_client.dart b/lib/electrumx_rpc/electrumx_client.dart index 9ca3dfeb1..98c6614f9 100644 --- a/lib/electrumx_rpc/electrumx_client.dart +++ b/lib/electrumx_rpc/electrumx_client.dart @@ -1020,6 +1020,18 @@ class ElectrumXClient { ], ); try { + // If the response is -1 or null, return a temporary hardcoded value for + // Dogecoin. This is a temporary fix until the fee estimation is fixed. + if (coin == Coin.dogecoin && + (response == null || + response == -1 || + Decimal.parse(response.toString()) == Decimal.parse("-1"))) { + // Return 0.05 for slow, 0.2 for average, and 1 for fast txs. + // These numbers produce tx fees in line with txs in the wild on + // https://dogechain.info/ + return Decimal.parse((1 / blocks).toString()); + // TODO [prio=med]: Fix fee estimation. + } return Decimal.parse(response.toString()); } catch (e, s) { final String msg = "Error parsing fee rate. Response: $response"