grow food, not lawn.

Skip to content

Add comprehensive tests for multi-output transaction tracking defect fix

Russell Ballestrini requested to merge feature/multi-output-refunds into master

This adds complete test coverage for the critical fix where multi-output refund transactions now set both refund_tx_hash AND swept_tx_hash to prevent re-sweeping already swept payments.

Key test scenarios covered:

  • Multi-output refund transaction creation (XMR and DOGE)
  • Shop sweep amount calculation: max(0, received_amount - refund_amount)
  • Prevention of double-sweep attempts when swept_tx_hash is already set
  • Same transaction hash handling for both refund and sweep monitoring
  • Real-world defect scenario using actual transaction hash from logs
  • Edge cases including full refunds and negative amount protection

The tests validate that the "insufficient funds" error has been resolved by ensuring payments with existing swept_tx_hash are not swept again.

Summary by CodeRabbit

  • New Features
    • Improved tracking for multi-output refund transactions, recording both refund and shop-sweep details with clearer event logs.
  • Bug Fixes
    • Prevents double-sweeping when a sweep has already occurred.
    • More accurate Monero confirmation checks for specific accounts/subaddresses.
  • Documentation
    • Added “Cryptocurrency RPC Access” guidance for Monero and Dogecoin.
    • Expanded “UUID Objects” section with usage tips and examples.
  • Tests
    • Added comprehensive tests covering multi-output refunds, sweep accounting, and XMR/DOGE edge cases.
  • Style
    • Minor formatting and string style consistency updates.
Edited by CodeRabbit

Merge request reports