mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 09:47:35 +00:00
minor code cleanup & friendlier error message on failed tx's
This commit is contained in:
parent
b77afee7ec
commit
b38deb4e7e
1 changed files with 6 additions and 4 deletions
|
@ -32,7 +32,6 @@ import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
||||||
import 'package:cw_bitcoin/electrum_balance.dart';
|
import 'package:cw_bitcoin/electrum_balance.dart';
|
||||||
import 'package:cw_bitcoin/litecoin_network.dart';
|
import 'package:cw_bitcoin/litecoin_network.dart';
|
||||||
import 'package:cw_mweb/cw_mweb.dart';
|
import 'package:cw_mweb/cw_mweb.dart';
|
||||||
import 'package:cw_mweb/mwebd.pb.dart';
|
|
||||||
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
|
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
|
||||||
import 'package:bip39/bip39.dart' as bip39;
|
import 'package:bip39/bip39.dart' as bip39;
|
||||||
|
|
||||||
|
@ -278,7 +277,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
||||||
}
|
}
|
||||||
if (!(tx.inputAddresses?.contains(utxo.address) ?? false)) {
|
if (!(tx.inputAddresses?.contains(utxo.address) ?? false)) {
|
||||||
addressRecord.txCount++;
|
addressRecord.txCount++;
|
||||||
print("COUNT UPDATED HERE 2!!!!! ${addressRecord.txCount}");
|
// print("COUNT UPDATED HERE 2!!!!! ${addressRecord.txCount}");
|
||||||
}
|
}
|
||||||
addressRecord.balance += utxo.value.toInt();
|
addressRecord.balance += utxo.value.toInt();
|
||||||
addressRecord.setAsUsed();
|
addressRecord.setAsUsed();
|
||||||
|
@ -380,7 +379,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
||||||
.firstWhere((addressRecord) => addressRecord.address == utxo.address);
|
.firstWhere((addressRecord) => addressRecord.address == utxo.address);
|
||||||
if (!inputAddresses.contains(utxo.address)) {
|
if (!inputAddresses.contains(utxo.address)) {
|
||||||
addressRecord.txCount++;
|
addressRecord.txCount++;
|
||||||
print("COUNT UPDATED HERE 3!!!!! ${addressRecord.address} ${addressRecord.txCount} !!!!!!");
|
// print("COUNT UPDATED HERE 3!!!!! ${addressRecord.address} ${addressRecord.txCount} !!!!!!");
|
||||||
}
|
}
|
||||||
addressRecord.balance -= utxo.value.toInt();
|
addressRecord.balance -= utxo.value.toInt();
|
||||||
amount += utxo.value.toInt();
|
amount += utxo.value.toInt();
|
||||||
|
@ -542,7 +541,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addressRecord.txCount++;
|
addressRecord.txCount++;
|
||||||
print("COUNT UPDATED HERE 0!!!!! ${addressRecord.address} ${addressRecord.txCount} !!!!!!");
|
// print("COUNT UPDATED HERE 0!!!!! ${addressRecord.address} ${addressRecord.txCount} !!!!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,6 +681,9 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
print(e);
|
print(e);
|
||||||
print(s);
|
print(s);
|
||||||
|
if (e.toString().contains("commit failed")) {
|
||||||
|
throw Exception("Transaction commit failed (no peers responded), please try again.");
|
||||||
|
}
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue