Skip to content

Commit 2cf7d6d

Browse files
committed
fix: more bch zero conf special case fixes
1 parent 88d0638 commit 2cf7d6d

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

lib/pages/wallet_view/sub_widgets/transactions_list.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
9494
TransactionCard(
9595
// this may mess with combined firo transactions
9696
key: isConfirmed
97-
? Key(tx.txid + tx.type.name + tx.address.value.toString())
97+
? Key(tx.txid +
98+
tx.type.name +
99+
tx.address.value.toString() +
100+
tx.height.toString())
98101
: UniqueKey(), //
99102
transaction: tx,
100103
walletId: widget.walletId,
@@ -191,7 +194,10 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
191194
child: TransactionCard(
192195
// this may mess with combined firo transactions
193196
key: isConfirmed
194-
? Key(tx.txid + tx.type.name + tx.address.value.toString())
197+
? Key(tx.txid +
198+
tx.type.name +
199+
tx.address.value.toString() +
200+
tx.height.toString())
195201
: UniqueKey(),
196202
transaction: tx,
197203
walletId: widget.walletId,

lib/pages/wallet_view/transaction_views/transaction_details_view.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ class _TransactionDetailsViewState
112112
super.dispose();
113113
}
114114

115-
String whatIsIt(TransactionType type, int height) {
115+
String whatIsIt(Transaction tx, int height) {
116+
final type = tx.type;
116117
if (coin == Coin.firo || coin == Coin.firoTestNet) {
117-
if (_transaction.subType == TransactionSubType.mint) {
118-
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
118+
if (tx.subType == TransactionSubType.mint) {
119+
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
119120
return "Minted";
120121
} else {
121122
return "Minting";
@@ -127,13 +128,13 @@ class _TransactionDetailsViewState
127128
// if (_transaction.isMinting) {
128129
// return "Minting";
129130
// } else
130-
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
131+
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
131132
return "Received";
132133
} else {
133134
return "Receiving";
134135
}
135136
} else if (type == TransactionType.outgoing) {
136-
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
137+
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
137138
return "Sent";
138139
} else {
139140
return "Sending";
@@ -428,7 +429,7 @@ class _TransactionDetailsViewState
428429
_transaction.isCancelled
429430
? "Cancelled"
430431
: whatIsIt(
431-
_transaction.type,
432+
_transaction,
432433
currentHeight,
433434
),
434435
style:
@@ -545,7 +546,7 @@ class _TransactionDetailsViewState
545546
_transaction.isCancelled
546547
? "Cancelled"
547548
: whatIsIt(
548-
_transaction.type,
549+
_transaction,
549550
currentHeight,
550551
),
551552
style: isDesktop

lib/services/coins/bitcoincash/bitcoincash_wallet.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,8 @@ class BitcoinCashWallet extends CoinServiceAPI
19581958

19591959
if (storedTx == null ||
19601960
storedTx.address.value == null ||
1961-
storedTx.height == null
1961+
storedTx.height == null ||
1962+
(storedTx.height != null && storedTx.height! <= 0)
19621963
// zero conf messes this up
19631964
// !storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)
19641965
) {

0 commit comments

Comments
 (0)