Bug: /wallet/balance endpoint lacks exception handling for SQLite errors#2043
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
Hi @Scottcjn Bill here, looks like the Skein has pushed 8 files are line-ending artifacts from a Windows build environment. I'll clean that up ASAP. The intended changes are only in node/rewards_implementation_rip200.py and node/tests/test_balance_endpoint.py. Sorry, still working on the Skein! bill0151 |
|
Good security fix addressing #1993 — wrapping the Before we can merge:
Once fixed: 15 RTC approved. Tip: |
b7c4bca to
c4bd19e
Compare
|
Hello again @Scottcjn — pushed the fix: constants moved outside the import block and the diff is now down to the 2 intended files only. |
FILE: node/rewards_implementation_rip200.py
NEW ADDITION (insert after line ~65):
REASON: These constants improve code readability and maintainability for API error messages and financial precision.
FILE: node/rewards_implementation_rip200.py
FUNCTION: get_balance (line ~189 in current source)
BEFORE (existing code — shown for context, do NOT include in PR):
AFTER (your replacement — this IS the PR content):
REASON: This change adds robust error handling for database operations, preventing unhandled 500 errors and providing specific responses for operational issues like database locks, and ensures RTC amounts are rounded for consistent precision.
REASON: This new test suite thoroughly validates the
/wallet/balanceendpoint, covering success cases, missing/invalid parameters, and critical database error scenarios, ensuring the robustness and correctness of the API.