mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-05 12:44:09 +01:00
Node Auto-reconnect and connectivity enhancements (#1513)
* Add auto-reconnect Enhance connectivity issues * minor enhancement [skip ci] * minor: remove core secrets since it's empty * pending transactions fix * temporary fix for RBF * remove unused hashes from cache key * fix minimum limits check * Add authentication to services api * update polyseed * override hashlib package
This commit is contained in:
@@ -97,26 +97,7 @@ abstract class ElectrumWalletBase
|
||||
this.walletInfo = walletInfo;
|
||||
transactionHistory = ElectrumTransactionHistory(walletInfo: walletInfo, password: password);
|
||||
|
||||
reaction((_) => syncStatus, (SyncStatus syncStatus) async {
|
||||
if (syncStatus is! AttemptingSyncStatus && syncStatus is! SyncedTipSyncStatus) {
|
||||
silentPaymentsScanningActive = syncStatus is SyncingSyncStatus;
|
||||
}
|
||||
|
||||
if (syncStatus is NotConnectedSyncStatus) {
|
||||
// Needs to re-subscribe to all scripthashes when reconnected
|
||||
_scripthashesUpdateSubject = {};
|
||||
|
||||
// TODO: double check this and make sure it doesn't cause any un-necessary calls
|
||||
// await this.electrumClient.connectToUri(node!.uri, useSSL: node!.useSSL);
|
||||
}
|
||||
|
||||
// Message is shown on the UI for 3 seconds, revert to synced
|
||||
if (syncStatus is SyncedTipSyncStatus) {
|
||||
Timer(Duration(seconds: 3), () {
|
||||
if (this.syncStatus is SyncedTipSyncStatus) this.syncStatus = SyncedSyncStatus();
|
||||
});
|
||||
}
|
||||
});
|
||||
reaction((_) => syncStatus, _syncStatusReaction);
|
||||
}
|
||||
|
||||
static bitcoin.HDWallet getAccountHDWallet(
|
||||
@@ -201,6 +182,8 @@ abstract class ElectrumWalletBase
|
||||
@observable
|
||||
bool silentPaymentsScanningActive = false;
|
||||
|
||||
bool _isTryingToConnect = false;
|
||||
|
||||
@action
|
||||
Future<void> setSilentPaymentsScanning(bool active, bool usingElectrs) async {
|
||||
silentPaymentsScanningActive = active;
|
||||
@@ -1830,6 +1813,38 @@ abstract class ElectrumWalletBase
|
||||
syncStatus = NotConnectedSyncStatus();
|
||||
}
|
||||
}
|
||||
|
||||
void _syncStatusReaction(SyncStatus syncStatus) async {
|
||||
if (syncStatus is! AttemptingSyncStatus && syncStatus is! SyncedTipSyncStatus) {
|
||||
silentPaymentsScanningActive = syncStatus is SyncingSyncStatus;
|
||||
}
|
||||
|
||||
if (syncStatus is NotConnectedSyncStatus) {
|
||||
// Needs to re-subscribe to all scripthashes when reconnected
|
||||
_scripthashesUpdateSubject = {};
|
||||
|
||||
if (_isTryingToConnect) return;
|
||||
|
||||
_isTryingToConnect = true;
|
||||
|
||||
Future.delayed(Duration(seconds: 10), () {
|
||||
if (this.syncStatus is! SyncedSyncStatus && this.syncStatus is! SyncedTipSyncStatus) {
|
||||
this.electrumClient.connectToUri(
|
||||
node!.uri,
|
||||
useSSL: node!.useSSL ?? false,
|
||||
);
|
||||
}
|
||||
_isTryingToConnect = false;
|
||||
});
|
||||
}
|
||||
|
||||
// Message is shown on the UI for 3 seconds, revert to synced
|
||||
if (syncStatus is SyncedTipSyncStatus) {
|
||||
Timer(Duration(seconds: 3), () {
|
||||
if (this.syncStatus is SyncedTipSyncStatus) this.syncStatus = SyncedSyncStatus();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScanNode {
|
||||
|
||||
@@ -866,10 +866,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: unorm_dart
|
||||
sha256: "5b35bff83fce4d76467641438f9e867dc9bcfdb8c1694854f230579d68cd8f4b"
|
||||
sha256: "23d8bf65605401a6a32cff99435fed66ef3dab3ddcad3454059165df46496a3b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.3.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user