Remove spec parameter from MagicMock to avoid triggering SQLAlchemy mapper
initialization during test setup. Tests remain effective by validating actual
crypto watcher logic while mocking only the database object interfaces.
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.