mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-09 12:19:24 +00:00
Merge pull request #762 from cypherstack/dogecoin
Temporary Dogecoin fee estimation hackfix
This commit is contained in:
commit
f00fb01757
2 changed files with 25 additions and 1 deletions
|
@ -1013,6 +1013,29 @@ class ElectrumXClient {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
try {
|
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());
|
return Decimal.parse(response.toString());
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
final String msg = "Error parsing fee rate. Response: $response"
|
final String msg = "Error parsing fee rate. Response: $response"
|
||||||
|
|
|
@ -1776,7 +1776,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
||||||
Logging.instance.log("prepare send: $result", level: LogLevel.Info);
|
Logging.instance.log("prepare send: $result", level: LogLevel.Info);
|
||||||
if (result.fee!.raw.toInt() < result.vSize!) {
|
if (result.fee!.raw.toInt() < result.vSize!) {
|
||||||
throw Exception(
|
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;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue