Fix history auto refresh when pending tx is present and minor ui fixes
What changed, and why it matters
This commit fixes a bug where the transaction history auto-refresh would break when a transaction was still pending (not yet mined). It also makes small user-interface tweaks, such as making list items easier to tap and widening text boxes in transaction details. There is no clear security vulnerability being patched.
No security action required. Treat as a routine bug-fix/UI polish commit. If desired, verify that pending transactions now display 0 confirmations and that the app no longer throws when refreshing history with unconfirmed transactions.
Security signals we found
Defensive guard added for unconfirmed transaction block height (-1)
UI-only changes (tap targets, layout constraints, text alignment)
No changes to key handling, networking, storage, or authentication
Evidence from the diff
The core change is in wallet_model.dart: confirmation count calculation now guards against unconfirmed transactions (block height -1), preventing a likely arithmetic exception or incorrect value when a pending transaction is present. The remaining changes are UI-only: adding HitTestBehavior.opaque to transaction list items, increasing maxWidth constraints in tx_details.dart, and adjusting recipient address alignment/wrapping. No cryptographic, authentication, or network security fixes are visible in the diff.
Changed components
lib/models/wallet_model.dartlib/screens/wallet_home.dartlib/widgets/tx_details.dartInspect captured patch +13 / −8
diff --git a/lib/models/wallet_model.dart b/lib/models/wallet_model.dart
index fcbfbcb..75c1f8f 100644
--- a/lib/models/wallet_model.dart
+++ b/lib/models/wallet_model.dart
@@ -1083,7 +1083,7 @@ class WalletModel with ChangeNotifier {
final fee = doubleAmountFromInt(tx.fee());
final timestamp = tx.timestamp();
final height = tx.blockHeight();
- final confirmations = _w2Wallet!.blockChainHeight() - height + 1;
+ final confirmations = height > -1 ? _w2Wallet!.blockChainHeight() - height + 1 : 0;
final key = _w2Wallet!.getTxKey(txid: hash);
List<TxRecipient> recipients = [];
diff --git a/lib/screens/wallet_home.dart b/lib/screens/wallet_home.dart
index c3ae97a..5550da1 100644
--- a/lib/screens/wallet_home.dart
+++ b/lib/screens/wallet_home.dart
@@ -61,6 +61,7 @@ class _TransactionListItemState extends State<_TransactionListItem> {
: Colors.transparent,
),
child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
onTap: widget.onTap,
child: Padding(
padding: EdgeInsetsDirectional.symmetric(vertical: 10, horizontal: 20),
diff --git a/lib/widgets/tx_details.dart b/lib/widgets/tx_details.dart
index f481bea..c903475 100644
--- a/lib/widgets/tx_details.dart
+++ b/lib/widgets/tx_details.dart
@@ -51,7 +51,7 @@ class _TxDetailsDialog extends StatelessWidget {
Text(i18n.txDetailsHashLabel, style: TextStyle(fontWeight: FontWeight.bold)),
Flexible(
child: Container(
- constraints: BoxConstraints(maxWidth: 240),
+ constraints: BoxConstraints(maxWidth: 280),
child: GestureDetector(
child: Text(
txDetails.hash,
@@ -143,7 +143,7 @@ class _TxDetailsDialog extends StatelessWidget {
Text(i18n.txDetailsViewKeyLabel, style: TextStyle(fontWeight: FontWeight.bold)),
Flexible(
child: Container(
- constraints: BoxConstraints(maxWidth: 240),
+ constraints: BoxConstraints(maxWidth: 280),
child: GestureDetector(
child: Text(
txDetails.key,
@@ -177,13 +177,17 @@ class _TxDetailsDialog extends StatelessWidget {
final amountStr = recipient.amount.toString();
return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.end,
children: [
GestureDetector(
- child: Text(
- recipient.address,
- style: TextStyle(fontFamily: 'monospace'),
- softWrap: true,
+ child: Container(
+ constraints: BoxConstraints(maxWidth: 280),
+ child: Text(
+ recipient.address,
+ style: TextStyle(fontFamily: 'monospace'),
+ softWrap: true,
+ textAlign: TextAlign.end,
+ ),
),
onTap: () =>
Clipboard.setData(ClipboardData(text: recipient.address)),
Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.