refactor: change confirmations to non-late and add default value (#3148)
What changed, and why it matters
This commit changes a single Dart field in the Cake Wallet codebase from a 'late' integer (which must be assigned before use) to a normal integer with a default value of 0. The change is described as a refactor and is likely intended to prevent runtime errors where the field was read before being set. There is no direct evidence in the commit that this fixes an active security vulnerability, but uninitialized or late-initialized fields can sometimes contribute to crashes or unexpected behavior in wallet software.
Treat as a routine defensive refactor. Review whether other late-initialized fields in TransactionInfo or related model classes should also receive safe defaults, and verify that downstream code does not rely on the absence of a default value for correctness. No urgent security action is indicated by this commit alone.
Security signals we found
Change removes a late-initialized field, which can reduce a class of runtime errors.
No explicit security language in commit title or message.
No references to CVEs, advisories, bug bounty reports, or researcher attribution.
Single-line change in a non-cryptographic model class.
Default value of 0 for confirmations is semantically reasonable for an unconfirmed transaction.
Evidence from the diff
In cw_core/lib/transaction_info.dart, the field late int confirmations; is changed to int confirmations = 0;. This removes the ‘late’ modifier and provides a default value. The class is an abstract model for transaction metadata. The change ensures that confirmations is never in an unassigned state, which can avoid LateInitializationError exceptions if the field is accessed before explicit assignment. The commit title frames this as a refactor with a default value, not as a security fix.
Changed components
cw_core/lib/transaction_info.dartTransactionInfo abstract classInspect captured patch +1 / −1
diff --git a/cw_core/lib/transaction_info.dart b/cw_core/lib/transaction_info.dart
index 3e34af75..e3453747 100644
--- a/cw_core/lib/transaction_info.dart
+++ b/cw_core/lib/transaction_info.dart
@@ -10,7 +10,7 @@ abstract class TransactionInfo extends Object with Keyable {
late bool isPending;
late DateTime date;
int? height;
- late int confirmations;
+ int confirmations = 0;
String amountFormatted();
String fiatAmount();
String? feeFormatted();
Why this scored 16/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.