Fix for new outcomes and statuses#223
Open
RodriFS wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the daemon to recognize and persist newly introduced backend swap statuses/outcomes by extending the RPC/proto enums, the daemon’s status handling, and the database enum types via migrations.
Changes:
- Added two new swap statuses for “contract amount mismatch” across models, RPC mapping, and protobuf.
- Added a new swap outcome (
ERROR) to the models and a migration to extend the DB enum. - Updated swap-in/out monitors and tests to handle/cover the new statuses/outcome.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
daemon/rpc/handlers.go |
Maps new DB statuses to RPC enum values. |
daemon/rpc/40swapd.pb.go |
Regenerated protobuf Go bindings with new Status enum values. |
daemon/proto/40swapd.proto |
Extends Status enum with amount mismatch states. |
daemon/database/models/status_enum.go |
Adds new status constants and updates swap_status enum creation SQL. |
daemon/database/models/outcome_enum.go |
Adds OutcomeError constant. |
daemon/database/migrations.go |
Adds migrations to extend Postgres enum types for outcome/status. |
daemon/daemon/swap_out.go |
Handles/logs unexpected/new statuses for swap-out monitoring. |
daemon/daemon/swap_out_test.go |
Cleans up unused test constants. |
daemon/daemon/swap_in.go |
Adds handling for new mismatch statuses and ERROR outcome when done. |
daemon/daemon/daemon_test.go |
Adds test cases for new statuses and ERROR outcome. |
Files not reviewed (1)
- daemon/rpc/40swapd.pb.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…QL enum definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the daemon failing when it cannot save a status that it doesn't know to the database