Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync master with dev #126

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions txstratum/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def __init__(
self.app.router.add_get("/health", self.health)
self.app.router.add_get("/mining-status", self.mining_status)
self.app.router.add_get("/job-status", self.job_status)
self.app.router.add_options("/submit-job", self.get_options_response)
self.app.router.add_options("/cancel-job", self.get_options_response)
self.app.router.add_post("/submit-job", self.submit_job)
self.app.router.add_post("/cancel-job", self.cancel_job)

Expand Down Expand Up @@ -120,6 +122,14 @@ async def mining_status(self, request: web.Request) -> web.Response:
"""Return status of miners."""
return web.json_response(self.manager.status())

async def get_options_response(self, request: web.Request) -> web.Response:
"""
Return empty success response.

This endpoint is required to make CORS work when using the desktop wallet with a local tx-mining-service.
"""
return web.json_response("{}", status=200)

async def submit_job(self, request: web.Request) -> web.Response:
"""Submit a new tx job to the manager.

Expand Down
Loading