Some more fixes

This commit is contained in:
Hector Chu 2024-04-28 14:12:12 +01:00
parent 8964774c51
commit b39b2bbb99
3 changed files with 9 additions and 8 deletions

View file

@ -792,7 +792,6 @@ abstract class ElectrumWalletBase
coin.isFrozen = coinInfo.isFrozen;
coin.isSending = coinInfo.isSending;
coin.note = coinInfo.note;
coin.bitcoinAddressRecord.balance += coinInfo.value;
} else {
_addCoinInfo(coin);
}

View file

@ -133,6 +133,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
final stub = await CwMweb.stub();
Timer.periodic(
const Duration(milliseconds: 1500), (timer) async {
if (syncStatus is FailedSyncStatus) return;
final height = await electrumClient.getCurrentBlockChainTip() ?? 0;
final resp = await stub.status(StatusRequest());
if (resp.blockHeaderHeight < height) {
@ -145,10 +146,10 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
syncStatus = SyncingSyncStatus(1, 0.999);
} else {
syncStatus = SyncedSyncStatus();
}
if (resp.mwebUtxosHeight > mwebUtxosHeight) {
mwebUtxosHeight = resp.mwebUtxosHeight;
await checkMwebUtxosSpent();
if (resp.mwebUtxosHeight > mwebUtxosHeight) {
mwebUtxosHeight = resp.mwebUtxosHeight;
await checkMwebUtxosSpent();
}
}
});
processMwebUtxos();
@ -192,7 +193,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
tx.height = utxo.height;
tx.isPending = utxo.height == 0;
tx.confirmations = confirmations;
if (transactionHistory.transactions[utxo.outputId] == null) {
if (transactionHistory.transactions[tx.id] == null) {
final addressRecord = walletAddresses.allAddresses.firstWhere(
(addressRecord) => addressRecord.address == utxo.address);
addressRecord.txCount++;

View file

@ -1,3 +1,4 @@
import 'package:grpc/grpc.dart';
import 'package:cw_bitcoin/exceptions.dart';
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:blockchain_utils/blockchain_utils.dart';
@ -91,8 +92,8 @@ class PendingBitcoinTransaction with PendingTransaction {
final stub = await CwMweb.stub();
final resp = await stub.broadcast(BroadcastRequest(rawTx: BytesUtils.fromHexString(hex)));
idOverride = resp.txid;
} catch (e) {
throw BitcoinTransactionCommitFailed();
} on GrpcError catch (e) {
throw BitcoinTransactionCommitFailed(errorMessage: e.message);
} else {
await _commit();
}