Skip to content

Feat/swap expiry timeout - #96

Merged
fejilaup-cloud merged 2 commits into
AtomicIP:mainfrom
graycioustukura-sketch:feat/swap-expiry-timeout
Mar 26, 2026
Merged

Feat/swap expiry timeout#96
fejilaup-cloud merged 2 commits into
AtomicIP:mainfrom
graycioustukura-sketch:feat/swap-expiry-timeout

Conversation

@graycioustukura-sketch

Copy link
Copy Markdown

close #19

- Add expiry: u64 to SwapRecord, set at initiation as ledger timestamp
  + configurable duration (defaults to DEFAULT_SWAP_DURATION_SECS = 86400s)
- initiate_swap gains a duration_secs param; pass 0 for the 24h default
- Add cancel_expired_swap: only the buyer may call it, only on an Accepted
  swap, and only after the expiry timestamp has passed; panics otherwise
- cancel_swap now restricted to Pending-only to keep semantics clean
- Add tests:
  - test_cancel_expired_swap_after_timeout: full happy-path expiry flow
  - test_cancel_expired_swap_before_timeout_panics
  - test_cancel_expired_swap_non_buyer_panics
  - test_cancel_expired_swap_on_pending_panics
  - test_reveal_key_before_expiry_completes_swap: existing flow unaffected
@drips-wave

drips-wave Bot commented Mar 25, 2026

Copy link
Copy Markdown

@graycioustukura-sketch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@fejilaup-cloud
fejilaup-cloud merged commit 808ffbc into AtomicIP:main Mar 26, 2026
0 of 4 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.

Fix: no swap timeout mechanism — accepted swaps can be locked forever

2 participants