mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 10:45:08 +00:00
fix: status toggle
This commit is contained in:
parent
aee365ca7f
commit
802935d974
2 changed files with 8 additions and 10 deletions
|
@ -198,10 +198,11 @@ abstract class ElectrumWalletBase
|
|||
|
||||
@action
|
||||
Future<void> setSilentPaymentsScanning(bool active) async {
|
||||
syncStatus = AttemptingSyncStatus();
|
||||
silentPaymentsScanningActive = active;
|
||||
|
||||
if (active) {
|
||||
syncStatus = AttemptingSyncStatus();
|
||||
|
||||
final tip = await getUpdatedChainTip();
|
||||
|
||||
if (tip == walletInfo.restoreHeight) {
|
||||
|
@ -214,7 +215,7 @@ abstract class ElectrumWalletBase
|
|||
} else {
|
||||
alwaysScan = false;
|
||||
|
||||
_isolate?.then((runningIsolate) => runningIsolate.kill(priority: Isolate.immediate));
|
||||
(await _isolate)?.kill(priority: Isolate.immediate);
|
||||
|
||||
if (electrumClient.isConnected) {
|
||||
syncStatus = SyncedSyncStatus();
|
||||
|
@ -387,15 +388,14 @@ abstract class ElectrumWalletBase
|
|||
B_scan: silentAddress.B_scan,
|
||||
B_spend: unspent.silentPaymentLabel != null
|
||||
? silentAddress.B_spend.tweakAdd(
|
||||
BigintUtils.fromBytes(
|
||||
BytesUtils.fromHexString(unspent.silentPaymentLabel!)),
|
||||
BigintUtils.fromBytes(BytesUtils.fromHexString(unspent.silentPaymentLabel!)),
|
||||
)
|
||||
: silentAddress.B_spend,
|
||||
hrp: silentAddress.hrp,
|
||||
);
|
||||
|
||||
final addressRecord = walletAddresses.silentAddresses.firstWhereOrNull(
|
||||
(address) => address.address == silentPaymentAddress.toString());
|
||||
final addressRecord = walletAddresses.silentAddresses
|
||||
.firstWhereOrNull((address) => address.address == silentPaymentAddress.toString());
|
||||
addressRecord?.txCount += 1;
|
||||
addressRecord?.balance += unspent.value;
|
||||
|
||||
|
|
|
@ -501,7 +501,7 @@ class CWBitcoin extends Bitcoin {
|
|||
Future<void> setScanningActive(Object wallet, bool active) async {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
|
||||
if (!(await getNodeIsElectrsSPEnabled(wallet))) {
|
||||
if (active && !(await getNodeIsElectrsSPEnabled(wallet))) {
|
||||
final node = Node(
|
||||
useSSL: false,
|
||||
uri: 'electrs.cakewallet.com:${(wallet.network == BitcoinNetwork.testnet ? 50002 : 50001)}',
|
||||
|
@ -564,8 +564,6 @@ class CWBitcoin extends Bitcoin {
|
|||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
final tweaksResponse = await bitcoinWallet.electrumClient.getTweaks(height: 0);
|
||||
|
||||
print('tweaksResponse: $tweaksResponse');
|
||||
|
||||
if (tweaksResponse != null) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue