From 678a926ff337b46d6936db3c526ffbf2bd5152bc Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 24 Mar 2023 16:43:34 -0600 Subject: [PATCH] bch zero conf fixes --- .../transaction_details_view.dart | 30 ++++++++++++------- .../coins/bitcoincash/bitcoincash_wallet.dart | 6 ++-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart index 77decdfcb..056b8da4b 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart @@ -968,17 +968,25 @@ class _TransactionDetailsViewState ? const EdgeInsets.all(16) : const EdgeInsets.all(12), child: Builder(builder: (context) { - final height = widget.coin != Coin.epicCash && - _transaction.isConfirmed( - currentHeight, - coin.requiredConfirmations, - ) - ? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" - : _transaction.getConfirmations( - currentHeight) > - 0 - ? "${_transaction.height}" - : "Pending"; + final String height; + + if (widget.coin == Coin.bitcoincash || + widget.coin == Coin.bitcoincashTestnet) { + height = + "${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}"; + } else { + height = widget.coin != Coin.epicCash && + _transaction.isConfirmed( + currentHeight, + coin.requiredConfirmations, + ) + ? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" + : _transaction.getConfirmations( + currentHeight) > + 0 + ? "${_transaction.height}" + : "Pending"; + } return Row( mainAxisAlignment: diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index d954371d7..a6d35e8f8 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -2120,8 +2120,10 @@ class BitcoinCashWallet extends CoinServiceAPI .txidEqualTo(txHash["tx_hash"] as String) .findFirst(); - if (storedTx == null || - !storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)) { + if (storedTx == null || storedTx.address.value == null + // zero conf messes this up + // !storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS) + ) { final tx = await cachedElectrumXClient.getTransaction( txHash: txHash["tx_hash"] as String, verbose: true,