Skip to content

fix: address Lukasz review comments from PR #564#583

Merged
PastaPastaPasta merged 3 commits into
dashpay:feat/dashpay-contacts-improvementsfrom
thepastaclaw:fix/lukasz-review-comments
Feb 17, 2026
Merged

fix: address Lukasz review comments from PR #564#583
PastaPastaPasta merged 3 commits into
dashpay:feat/dashpay-contacts-improvementsfrom
thepastaclaw:fix/lukasz-review-comments

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

Summary

Addresses all 9 review comments from @lklimek on PR #564.

Changes

1. CRITICAL — BitOrAssign drops tasks (contact_requests.rs)
fetch_unresolved_profiles() used action |= AppAction::BackendTask(task) in a loop, but BitOrAssign for AppAction simply replaces self with rhs — only the last profile fetch would fire. Fixed by collecting all tasks into a Vec and using AppAction::BackendTasks(..., Concurrent).

2. HIGH — Dummy [0x02; 33] pubkey (payments.rs)
load_payment_history() created a fake-but-valid P2PKH address from a dummy compressed public key. Changed PaymentRecord.to_address to Option<Address> and use None for historical records loaded from the database.

3. HIGH — i64 as u64 wrapping for amounts (payments.rs)
sp.amount as u64 silently wraps negative values. Added bounds checking with tracing::warn! for negative amounts, clamping to 0.

4. MEDIUM — Duplicate payment history logic (dashpay.rs)
DashPayTask::LoadPaymentHistory handler had its own inline implementation duplicating payments::load_payment_history(). Refactored to call the shared function and convert results.

5. MEDIUM — N+1 database queries (contact_requests.rs)
resolve_names_from_local_cache() called load_dashpay_contacts() per-request inside the loop. Fixed by pre-loading all contacts once into a HashMap for O(1) lookups.

6. MEDIUM — created_at: None breaks filters (contacts_list.rs)
Contacts from DashPayContactsWithInfo results got created_at: None, breaking "Recent" filter and "Date added" sort. Fixed by using current timestamp as fallback.

7. LOW — "failed" as failure reason (payments.rs)
PaymentStatus::Failed(sp.status.clone()) stored the literal string "failed". Changed to use descriptive "Transaction failed" message.

8. LOW — i64 as u64 for timestamps (payments.rs)
Same wrapping risk as #3 for sp.created_at as u64. Fixed consistently with bounds checking.

9. LOW — i64 as u64 in dashpay.rs
Eliminated entirely by fix #4 (duplicate code removed).

1. CRITICAL: Fix BitOrAssign dropping tasks in fetch_unresolved_profiles()
   - Changed from action |= AppAction::BackendTask(task) loop (which only
     kept the last task) to collecting all tasks into a Vec and dispatching
     via AppAction::BackendTasks with Concurrent execution mode.

2. HIGH: Remove dummy [0x02; 33] pubkey in load_payment_history()
   - Changed PaymentRecord.to_address from Address to Option<Address>
   - Historical records loaded from DB now use None instead of generating
     a fake-but-valid P2PKH address from a dummy public key.

3. HIGH: Fix i64 as u64 wrapping for amounts (payments.rs and dashpay.rs)
   - Added bounds checking with warning logs for negative amounts,
     clamping to 0 instead of silently wrapping.

4. MEDIUM: Eliminate duplicate payment history logic in dashpay.rs
   - LoadPaymentHistory task handler now calls the shared
     payments::load_payment_history() and converts results, instead of
     reimplementing the same logic with different return types.

5. MEDIUM: Fix N+1 database queries in resolve_names_from_local_cache()
   - Pre-load all contacts once before the loop and build a HashMap
     for O(1) lookups instead of calling load_dashpay_contacts() and
     load_dashpay_profile() per request inside the loop.

6. MEDIUM: Fix created_at: None breaking filters in contacts_list.rs
   - Contacts from DashPayContactsWithInfo results now get current
     timestamp as fallback instead of None, so they work with
     'Recent' filter and 'Date added' sort.

7. LOW: Fix 'failed' as failure reason in payment status
   - Changed PaymentStatus::Failed to use descriptive 'Transaction failed'
     string instead of echoing the literal status column value 'failed'.

8. LOW: Fix i64 as u64 for timestamps in payments.rs
   - Added bounds checking with warning for negative timestamps,
     consistent with the amount fix.

9. LOW: Both i64 as u64 locations fixed (dashpay.rs duplicate removed
   entirely by fix dashpay#4, payments.rs fixed by fixes dashpay#3/dashpay#8).
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • master
  • v1.0-dev

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PastaPastaPasta PastaPastaPasta merged commit 2c81c86 into dashpay:feat/dashpay-contacts-improvements Feb 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants