Skip to content

fix(miner): retain unmarked send cache#354

Open
JSONbored wants to merge 2 commits into
entrius:testfrom
JSONbored:codex/miner-retain-unmarked-sends
Open

fix(miner): retain unmarked send cache#354
JSONbored wants to merge 2 commits into
entrius:testfrom
JSONbored:codex/miner-retain-unmarked-sends

Conversation

@JSONbored
Copy link
Copy Markdown
Contributor

Summary

  • retain unmarked destination-send cache entries when cleanup sees them as stale
  • keep marked stale entries removable so completed local cache still clears normally
  • add regression coverage for poller misses, cleanup, rediscovery, and mark_fulfilled retry behavior

Why

A transient contract/indexer read gap can make the miner poller drop an active swap after repeated get_swap() misses. The miner then calls cleanup_stale_sends() with the reduced active set. If that cleanup deletes an unmarked cached destination tx, a later rediscovered swap can broadcast destination funds again instead of retrying mark_fulfilled for the original tx.

Closes #353.

Validation

  • uv run pytest tests/test_fulfillment.py tests/test_swap_poller.py -q
  • uv run pytest tests/ -q
  • uv run ruff check .
  • uv run ruff format --check .
  • git diff --check
  • Codex Security diff scan: no reportable findings
  • CodeRabbit CLI review: 0 issues

Notes

The duplicate check found no open issue or PR for this exact cleanup_stale_sends / unmarked send-cache failure mode before publication.

Keep unmarked destination-send records when a transient poll miss drops a swap from the active set, so rediscovered swaps retry mark_fulfilled instead of broadcasting destination funds again.

Add regression coverage for stale send cleanup and poller-miss rediscovery.
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 20, 2026
@LandynDev
Copy link
Copy Markdown
Collaborator

LandynDev commented May 21, 2026

Can you give this a quick rebase on entrius:test and I'll dive in on reviewing it/checking it out @JSONbored

@JSONbored
Copy link
Copy Markdown
Contributor Author

Can you give this a quick rebase on entrius:test and I'll dive in on reviewing it/checking it out @JSONbored

Done! Thanks 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] miner unmarked send cache can be dropped after poll misses

2 participants