Skip to content

Unlock node wallet if locked (#31) - #65

Open
ocakciomursel-pixel wants to merge 1 commit into
BetterMoneyLabs:masterfrom
ocakciomursel-pixel:fix-31-unlock-wallet
Open

ocakciomursel-pixel wants to merge 1 commit into
BetterMoneyLabs:masterfrom
ocakciomursel-pixel:fix-31-unlock-wallet

Conversation

@ocakciomursel-pixel

Copy link
Copy Markdown

Fixes #31

Summary

  • Add optional wallet_password configuration field to chaincash_offchain::node::Config ([node] section in config/default.toml).
  • Add ensure_wallet_unlocked helper in chaincash_server::ServerState and chaincash_services::TransactionService to inspect wallet.status().await?.is_unlocked before reading change_address.
  • If the node wallet is locked, unlock it using the configured wallet_password via wallet.unlock(&password).await (or return a descriptive LockedWallet error if no password is configured) and re-fetch wallet.status() so change_address is populated.
  • Add unit tests in crates/chaincash_services/src/transaction.rs covering already-unlocked wallets, locked wallets with a configured password, and locked wallets without a configured password.

…s#31)

- Add optional `wallet_password` setting under `[node]` configuration
- Add `ensure_wallet_unlocked` check in `ServerState` and `TransactionService` to unlock the node wallet via `node.endpoints().wallet()?.unlock(...)` when locked
- Ensure wallet is unlocked before querying wallet addresses, private keys, UTXOs, change address, signing, and triggering wallet rescan
- Add unit tests verifying wallet unlock flow and locked-without-password error handling
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.

Unlock nodes wallet if locked

1 participant