feat: Add Bitcoin-Core style -walletnotify support#6
Open
craftsoldier wants to merge 1 commit into
Open
Conversation
Contributor
|
This is a great idea! Reviewing and will get this merged, really appreciate the contribution. |
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! |
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.
This PR introduces native
-walletnotifysupport tozecd, matching the well-known behavior of Bitcoin Core.Many node operators, exchanges, and payment processors rely on
-walletnotifyto trigger external webhooks or scripts (e.g., syncing transactions to a database like Supabase) without needing to set up heavy polling architectures.Changes
walletnotifytoAppConfig,ConfigFile, andCli(configurable viazecd.tomlor--walletnotify="script %s").WalletActorviaActorConfig.trigger_walletnotifyhelper function to spawn a detached background thread (std::thread::spawn) executing the command viastd::process::Command::new("sh"), safely replacing%swith the transaction ID.mempool_sync_step(for 0-conf incoming unmined transactions).Enhancementblock (for newly mined 1-conf shielded transactions).TransactionsInvolvingAddressblock (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!