Skip to content

feat: Add Bitcoin-Core style -walletnotify support#6

Open
craftsoldier wants to merge 1 commit into
zecrocks:mainfrom
zcashme:feat/walletnotify
Open

feat: Add Bitcoin-Core style -walletnotify support#6
craftsoldier wants to merge 1 commit into
zecrocks:mainfrom
zcashme:feat/walletnotify

Conversation

@craftsoldier

Copy link
Copy Markdown

This PR introduces native -walletnotify support to zecd, matching the well-known behavior of Bitcoin Core.

Many node operators, exchanges, and payment processors rely on -walletnotify to trigger external webhooks or scripts (e.g., syncing transactions to a database like Supabase) without needing to set up heavy polling architectures.

Changes

  • Added walletnotify to AppConfig, ConfigFile, and Cli (configurable via zecd.toml or --walletnotify="script %s").
  • Propagated the config down to WalletActor via ActorConfig.
  • Added a trigger_walletnotify helper function to spawn a detached background thread (std::thread::spawn) executing the command via std::process::Command::new("sh"), safely replacing %s with the transaction ID.
  • Hooked the trigger into the three primary discovery paths:
    • mempool_sync_step (for 0-conf incoming unmined transactions).
    • Enhancement block (for newly mined 1-conf shielded transactions).
    • TransactionsInvolvingAddress block (for newly mined 1-conf transparent transactions).

Implementation Details

The execution is intentionally offloaded to a detached thread so it does not block zecd's main asynchronous event loop or freeze background sync.

Happy to make any adjustments to match the project's preferred styling or architecture!

@emersonian

Copy link
Copy Markdown
Contributor

This is a great idea! Reviewing and will get this merged, really appreciate the contribution.

@craftsoldier

Copy link
Copy Markdown
Author

Cheers from the zcashme team! We use zecd a lot internally and hope you get funded at the Q3 retrospective grant. This is a fully functioning wallet you built solo without the ZODL team's help — cheers!

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.

2 participants