mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
temporary estimatefee hackfix
This commit is contained in:
parent
d4ebdbffeb
commit
e070c2d986
2 changed files with 25 additions and 1 deletions
|
@ -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"
|
||||
|
|
|
@ -1776,7 +1776,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue