fix: critical SQL syntax error in BFT _apply_settlement blocks all reward payouts#1825
Merged
Scottcjn merged 1 commit intoMar 24, 2026
Merged
Conversation
The # comments on lines 614-615 were inside a SQL string literal passed to sqlite3.execute(). SQLite does not support # as a comment delimiter (only -- and /* */), causing an 'unrecognized token' error at runtime. This means _apply_settlement() would crash every time BFT consensus reached quorum, silently preventing ALL miner reward payouts via the BFT engine. Fix: move the comments outside the SQL string while preserving the explanation. Severity: CRITICAL — blocks all BFT reward distribution.
Contributor
Author
|
Bounty claim — RTC wallet: RTCf720a28c62e0724b9f745e6dd64ad37b520c0b96 (consolidated claim on PR #1843) |
FlintLeng
approved these changes
Apr 24, 2026
Contributor
FlintLeng
left a comment
There was a problem hiding this comment.
Nice work on this PR — clean implementation with good attention to edge cases.
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.
Bug
In
node/rustchain_bft_consensus.py, the_apply_settlement()method has Python-style#comments inside a SQL string literal (lines 614-615):SQLite does not support
#as a comment delimiter (only--and/* */). This causes:Impact
CRITICAL — Every time BFT consensus reaches quorum and calls
_apply_settlement(), the method crashes. No miner rewards are ever distributed through the BFT engine.Verification
Fix
Move the comments outside the SQL string literal. The explanation is preserved as Python comments above the
conn.execute()call.Bounty: #305 (Bug Report, 5-15 RTC)