Skip to content

fix: CLI wallet console corruption after refresh password prompt#48

Merged
sn1f3rt merged 1 commit intomasterfrom
fix/wallet-cli-password-prompt-corruption
Mar 22, 2026
Merged

fix: CLI wallet console corruption after refresh password prompt#48
sn1f3rt merged 1 commit intomasterfrom
fix/wallet-cli-password-prompt-corruption

Conversation

@sn1f3rt
Copy link
Copy Markdown
Member

@sn1f3rt sn1f3rt commented Mar 19, 2026

Summary

  • Remove print_prompt() calls from on_money_received, on_money_spent, and on_get_password refresh callbacks
  • During auto-refresh, these callbacks run in a background thread and calling print_prompt() manipulates readline from a non-main thread — this is undefined behavior for readline and corrupts terminal state (echo disabled, input interpreted as commands)
  • During manual refresh, readline is already paused via PAUSE_READLINE() so print_prompt() is also incorrect
  • The message_writer() destructor already handles readline suspension via RAII, so messages display correctly without print_prompt(). The main thread's readline loop naturally redisplays the prompt.

Fixes #37

Calling print_prompt() from refresh callbacks (on_money_received,
on_money_spent, on_get_password) corrupts readline/terminal state.

During auto-refresh, these callbacks run in a background thread and
call print_prompt() which manipulates readline from a non-main
thread while the main thread is in rl_callback_read_char() — this
is undefined behavior for readline and corrupts terminal state.

During manual refresh, readline is already paused via PAUSE_READLINE()
so calling print_prompt() is also incorrect.

The message_writer() destructor already handles readline suspension
via RAII, so messages are displayed correctly without print_prompt().
The main thread's readline loop naturally redisplays the prompt.

Fixes #37
@sn1f3rt sn1f3rt added the bug Something isn't working label Mar 19, 2026
@sn1f3rt sn1f3rt self-assigned this Mar 19, 2026
@sn1f3rt sn1f3rt merged commit 696975f into master Mar 22, 2026
14 checks passed
@sn1f3rt sn1f3rt deleted the fix/wallet-cli-password-prompt-corruption branch March 22, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI Wallet password prompt interpreted as command after refresh (console input corruption)

2 participants