mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
show negative unconfirmed mweb balanaces + other fixes [skip ci]
This commit is contained in:
parent
6ec3b330e0
commit
6e45d99fed
4 changed files with 6 additions and 15 deletions
|
@ -378,14 +378,14 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
|||
// if the confirmations haven't changed, skip updating:
|
||||
if (tx.confirmations == confirmations) continue;
|
||||
|
||||
print("updating confs ${tx.id} from ${tx.confirmations} -> $confirmations");
|
||||
// print("updating confs ${tx.id} from ${tx.confirmations} -> $confirmations");
|
||||
|
||||
// if an outgoing tx is now confirmed, delete the utxo from the box (delete the unspent coin):
|
||||
if (tx.confirmations >= 2 &&
|
||||
tx.direction == TransactionDirection.outgoing &&
|
||||
tx.unspents != null) {
|
||||
for (var coin in tx.unspents!) {
|
||||
// print(coin.address);
|
||||
print(coin.address);
|
||||
final utxo = mwebUtxosBox.get(coin.address);
|
||||
if (utxo != null) {
|
||||
print("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||
|
@ -821,15 +821,6 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
|||
print(
|
||||
"utxo: ${isConfirmed ? "confirmed" : "unconfirmed"} ${utxo.spent ? "spent" : "unspent"} ${utxo.outputId} ${utxo.height} ${utxo.value}");
|
||||
|
||||
// print(utxo.)
|
||||
|
||||
// old behavior:
|
||||
// if (isConfirmed) {
|
||||
// confirmedMweb += utxo.value.toInt();
|
||||
// } else {
|
||||
// unconfirmedMweb += utxo.value.toInt();
|
||||
// }
|
||||
|
||||
if (isConfirmed) {
|
||||
confirmedMweb += utxo.value.toInt();
|
||||
}
|
||||
|
@ -838,7 +829,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
|||
unconfirmedMweb -= utxo.value.toInt();
|
||||
}
|
||||
|
||||
if (!isConfirmed) {
|
||||
if (!isConfirmed && !utxo.spent) {
|
||||
unconfirmedMweb += utxo.value.toInt();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -32,6 +32,6 @@ class MwebUtxo extends HiveObject {
|
|||
@HiveField(4)
|
||||
int blockTime;
|
||||
|
||||
@HiveField(5)
|
||||
@HiveField(5, defaultValue: false)
|
||||
bool spent;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class CwMweb {
|
|||
static RpcClient? _rpcClient;
|
||||
static ClientChannel? _clientChannel;
|
||||
static int? _port;
|
||||
static const TIMEOUT_DURATION = Duration(seconds: 5);
|
||||
static const TIMEOUT_DURATION = Duration(seconds: 15);
|
||||
static Timer? logTimer;
|
||||
|
||||
static void readFileWithTimer(String filePath) {
|
||||
|
|
|
@ -381,7 +381,7 @@ abstract class BalanceViewModelBase with Store {
|
|||
|
||||
bool _hasSecondAdditionalBalanceForWalletType(WalletType type) {
|
||||
if (wallet.type == WalletType.litecoin) {
|
||||
if ((wallet.balance[CryptoCurrency.ltc]?.secondAdditional ?? 0) > 0) {
|
||||
if ((wallet.balance[CryptoCurrency.ltc]?.secondAdditional ?? 0) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue