diff --git a/lib/electrumx_rpc/electrumx_client.dart b/lib/electrumx_rpc/electrumx_client.dart index 37509f9a2..0df6cf787 100644 --- a/lib/electrumx_rpc/electrumx_client.dart +++ b/lib/electrumx_rpc/electrumx_client.dart @@ -1013,6 +1013,29 @@ 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 Decimal.parse("0.00001024"); + // blockchain.estimatefee response for 1-, 5-, and 10--block intervals + // as of 2024/02/20 ("1.024e-05"). + // TODO [prio=med]: Fix fee estimation. Refer to the following: + // $ openssl s_client -connect dogecoin.stackwallet.com:50002 + // ... + // $ {"id": 1, "method": "blockchain.estimatefee", "params": [1]} + // {"jsonrpc": "2.0", "result": 1.024e-05, "id": 1} + // $ {"id": 1, "method": "blockchain.estimatefee", "params": [5]} + // {"jsonrpc": "2.0", "result": 1.024e-05, "id": 1} + // $ {"id": 1, "method": "blockchain.estimatefee", "params": [10]} + // {"jsonrpc": "2.0", "result": 1.024e-05, "id": 1} + // $ {"id": 1, "method": "blockchain.estimatefee", "params": [50]} + // {"jsonrpc": "2.0", "result": -1, "id": 1} + // $ {"id": 1, "method": "blockchain.estimatefee", "params": [100]} + // {"jsonrpc": "2.0", "result": -1, "id": 1}w + } return Decimal.parse(response.toString()); } catch (e, s) { final String msg = "Error parsing fee rate. Response: $response" diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart index 63d49368b..577d52044 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart @@ -1776,7 +1776,8 @@ mixin ElectrumXInterface on Bip39HDWallet { Logging.instance.log("prepare send: $result", level: LogLevel.Info); if (result.fee!.raw.toInt() < result.vSize!) { throw Exception( - "Error in fee calculation: Transaction fee cannot be less than vSize"); + "Error in fee calculation: Transaction fee (${result.fee!.raw.toInt()}) cannot " + "be less than vSize (${result.vSize})"); } return result;