Skip to content

refactor: replace WASM-based PoW solver with a native Go implementation in the pow package#229

Merged
CJackHwang merged 3 commits intomainfrom
dev
Apr 6, 2026
Merged

refactor: replace WASM-based PoW solver with a native Go implementation in the pow package#229
CJackHwang merged 3 commits intomainfrom
dev

Conversation

@CJackHwang
Copy link
Copy Markdown
Owner

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

📝 补充信息 | Additional Information

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Apr 6, 2026 4:36pm

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7d561694a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

bizData, _ := data["biz_data"].(map[string]any)
challenge, _ := bizData["challenge"].(map[string]any)
answer, err := c.powSolver.Compute(ctx, challenge)
answer, err := ComputePow(challenge)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor context cancellation during PoW solve

GetPow still accepts a request-scoped ctx, but this call now invokes ComputePow(challenge) without passing that context. Because the new pure-Go solver performs a CPU-bound search up to difficulty, canceled HTTP requests (client disconnects, timeouts, shutdown) will continue hashing until the loop completes, wasting CPU and delaying goroutine cleanup. Please thread ctx through the solver and check ctx.Done() periodically during the nonce scan.

Useful? React with 👍 / 👎.

@CJackHwang CJackHwang merged commit 10921e0 into main Apr 6, 2026
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.

1 participant