bch zero conf fixes

This commit is contained in:
julian 2023-03-24 16:43:34 -06:00
parent 7e6642cd84
commit 678a926ff3
2 changed files with 23 additions and 13 deletions

View file

@ -968,17 +968,25 @@ class _TransactionDetailsViewState
? const EdgeInsets.all(16) ? const EdgeInsets.all(16)
: const EdgeInsets.all(12), : const EdgeInsets.all(12),
child: Builder(builder: (context) { child: Builder(builder: (context) {
final height = widget.coin != Coin.epicCash && final String height;
_transaction.isConfirmed(
currentHeight, if (widget.coin == Coin.bitcoincash ||
coin.requiredConfirmations, widget.coin == Coin.bitcoincashTestnet) {
) height =
? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" "${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}";
: _transaction.getConfirmations( } else {
currentHeight) > height = widget.coin != Coin.epicCash &&
0 _transaction.isConfirmed(
? "${_transaction.height}" currentHeight,
: "Pending"; coin.requiredConfirmations,
)
? "${_transaction.height == 0 ? "Unknown" : _transaction.height}"
: _transaction.getConfirmations(
currentHeight) >
0
? "${_transaction.height}"
: "Pending";
}
return Row( return Row(
mainAxisAlignment: mainAxisAlignment:

View file

@ -2120,8 +2120,10 @@ class BitcoinCashWallet extends CoinServiceAPI
.txidEqualTo(txHash["tx_hash"] as String) .txidEqualTo(txHash["tx_hash"] as String)
.findFirst(); .findFirst();
if (storedTx == null || if (storedTx == null || storedTx.address.value == null
!storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)) { // zero conf messes this up
// !storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)
) {
final tx = await cachedElectrumXClient.getTransaction( final tx = await cachedElectrumXClient.getTransaction(
txHash: txHash["tx_hash"] as String, txHash: txHash["tx_hash"] as String,
verbose: true, verbose: true,