Merge pull request #753 from cypherstack/refresh-sync-issues

Address several refresh/sync issues
This commit is contained in:
Diego Salazar 2024-02-09 18:57:29 -07:00 committed by GitHub
commit 1229184088
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 6 deletions

View file

@ -397,8 +397,8 @@ class ElectrumXClient {
if (requestStrings.length > 1) {
Logging.instance.log(
"Map returned instead of a list and there are ${requestStrings.length} queued.",
level: LogLevel.Error);
"ElectrumXClient.batchRequest: Map returned instead of a list and there are ${requestStrings.length} queued.",
level: LogLevel.Error);
}
// Could throw error here.
} else {
@ -757,7 +757,7 @@ class ElectrumXClient {
if (response is! Map) {
final String msg = "getTransaction($txHash) returned a non-Map response"
" of type ${response.runtimeType}.";
" of type ${response.runtimeType}.\nResponse: $response";
Logging.instance.log(msg, level: LogLevel.Fatal);
throw Exception(msg);
}
@ -1032,7 +1032,14 @@ class ElectrumXClient {
blocks,
],
);
return Decimal.parse(response["result"].toString());
try {
return Decimal.parse(response["result"].toString());
} catch (e, s) {
final String msg = "Error parsing fee rate. Response: $response"
"\nResult: ${response["result"]}\nError: $e\nStack trace: $s";
Logging.instance.log(msg, level: LogLevel.Fatal);
throw Exception(msg);
}
} catch (e) {
rethrow;
}

View file

@ -192,7 +192,7 @@ class BitcoincashWallet extends Bip39HDWallet
addresses.addAll(prevOut.addresses);
} catch (e, s) {
Logging.instance.log(
"Error getting prevOutJson: $s\nStack trace: $s",
"Error getting prevOutJson: $e\nStack trace: $s",
level: LogLevel.Warning);
}
}

View file

@ -828,7 +828,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
_latestHeight = chainHeight;
if (isFirstResponse) {
if (isFirstResponse && !completer.isCompleted) {
// Return the chain height.
completer.complete(chainHeight);
}