confirms bugfix

This commit is contained in:
julian 2023-01-13 17:26:24 -06:00
parent ea212b3dd8
commit c503e8f8d8
2 changed files with 4 additions and 5 deletions

View file

@ -4,7 +4,6 @@ import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/address/address.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/input.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/output.dart';
import 'package:stackwallet/models/isar/models/transaction_note.dart';
part 'transaction.g.dart';
@ -49,8 +48,8 @@ class Transaction {
final outputs = IsarLinks<Output>();
int getConfirmations(int currentChainHeight) {
if (height == null) return 0;
return max(0, currentChainHeight - height!);
if (height == null || height! <= 0) return 0;
return max(0, currentChainHeight - (height! - 1));
}
bool isConfirmed(int currentChainHeight, int minimumConfirms) {

View file

@ -32,8 +32,8 @@ class UTXO {
int getConfirmations(int currentChainHeight) {
if (blockTime == null || blockHash == null) return 0;
if (blockHeight == null) return 0;
return max(0, currentChainHeight - blockHeight!);
if (blockHeight == null || blockHeight! <= 0) return 0;
return max(0, currentChainHeight - (blockHeight! - 1));
}
bool isConfirmed(int currentChainHeight, int minimumConfirms) {