Skip to content

doc: document -blocknotify, -walletnotify and other -*notify options - #35518

Open
fernandguil wants to merge 1 commit into
bitcoin:masterfrom
fernandguil:doc/notify-options
Open

fernandguil wants to merge 1 commit into
bitcoin:masterfrom
fernandguil:doc/notify-options

Conversation

@fernandguil

Copy link
Copy Markdown
Contributor

Partially addresses #14278, which asks for documentation of the user-facing -*notify behaviors. The five shell-command notification options currently have no documentation outside of --help text, and several behaviors are only discoverable by reading the source.

Adds doc/notifications.md (indexed in doc/README.md) covering:

-blocknotify

-walletnotify

  • Fires on mempool entry, confirmation, and when a transaction returns to unconfirmed due to a conflict with a newly connected block (CWallet::transactionRemovedFromMempool)
  • Documents all four substitutions (%s, %b, %h, %w) and the Windows limitation for %w

-alertnotify

  • Fires once per distinct warning condition; message is sanitized and single-quoted before substitution (src/node/kernel_notifications.cpp)

-startupnotify / -shutdownnotify

  • Startup command does not block initialization; shutdown commands may be specified multiple times, run in parallel, and shutdown waits for them to complete (src/init.cpp)

All described behavior is derived directly from the source.

@DrahtBot DrahtBot added the Docs label Jun 12, 2026
@DrahtBot

DrahtBot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK sedited

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@sedited

sedited commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

I don't think exhaustively documenting every command here is useful, and would prefer that the command-level docs continue to live in the help output / man page. Some of the documentation there could be expanded a bit, for example with the behaviour during IBD described here. The doc introduced here could be distilled down to a single paragraph explaining threading and ordering behaviour plus a list of the commands.

@fernandguil

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I've distilled the doc down to a single paragraph on the threading/ordering behavior plus a list of the options, leaving the per-option details in --help. I've also opened #35586 to add the IBD/reindex note to the -blocknotify help text, per your suggestion.

Comment thread doc/notifications.md Resolved
Comment thread doc/notifications.md Resolved
Comment thread doc/notifications.md Resolved
Adds doc/notifications.md describing the shell command notification
options (-blocknotify, -walletnotify, -alertnotify, -startupnotify,
-shutdownnotify), focusing on the cross-cutting threading and ordering
behavior that is not described in the per-option help output, plus a
list of the available options. Per-option details remain in --help.

Partially addresses bitcoin#14278.
@fernandguil

Copy link
Copy Markdown
Contributor Author

Thanks, all good points. Done: dropped the ZMQ comparison and the -shutdownnotify "return quickly" sentence, and split the em-dash sentence in two.

@sedited sedited left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5801ce7

sedited pushed a commit that referenced this pull request Aug 27, 2026
The -blocknotify command is suppressed for blocks connected during
initial block download and reindexing (it only fires once the node is
in the post-init sync state). Mention this in the option's help output.

Suggested in review of #35518.
sedited added a commit that referenced this pull request Aug 27, 2026
… help text

d5e64b0 doc: note -blocknotify is not run during IBD/reindex in help text (Guillermo Fernandes)

Pull request description:

  Adds a note to the `-blocknotify` help output that it is not executed for blocks connected during initial block download or reindexing (it only fires once the node reaches the post-init sync state). Suggested by sedited in review of #35518.

ACKs for top commit:
  sedited:
    ACK d5e64b0

Tree-SHA512: 06b4a3c6354689e9846b5af6c210c3bb360b917477ac9506814c0238a1afb78392c4b6a6bbd51a4b9d98c841a1bc86686e90072155ce9a4f5e8f875cfe288c0c
@sedited
sedited requested a review from willcl-ark September 9, 2026 15:12
@willcl-ark

willcl-ark commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

I will take a look here soon.

I did once have a got at correcting this myself with the intention of closing out #14278 in one go, but the branch may be outdated now: https://github.com/willcl-ark/bitcoin/tree/callback-docs-cleanup

I remember adding a few tests for guarantees I we were giving but were untested (see commits in the branch), that may be something we want to do here too, if it makes sense...

edit: yeah re-reading my old branch I don't feel that happy with it now, I have now updated it and will compare with this branch soon

@sedited

sedited commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

I remember adding a few tests for guarantees I we were giving but were untested (see commits in the branch), that may be something we want to do here too, if it makes sense...

I'm not sure if we really want to guarantee order. It just seems like a brittle thing to be promising. The tests might also not fully capture the ordering guarantee. A test exercising ordering between e.g. rpc and zmq might not catch something in a different component, or in some edge case that we didn't happen to think of. Has anybody complained about this since the original issue was opened? I can also see an argument for it though: We implicitly guarantee order and unwittingly changing something might break somebody's deployment.

@willcl-ark

Copy link
Copy Markdown
Member

I'm not sure if we really want to guarantee order. It just seems like a brittle thing to be promising.

Agreed, and ordering (or really any notification legitimacy) is called out here in my branch as basically never being guaranteed:

Bitcoin Core can notify external software about node, chain, mempool, wallet,
and warning events. Notifications are useful for waking up external processes,
but they are not a substitute for querying the node for current state. When a
notification is received, use the RPC interface to confirm the state that is
relevant to the application.

The tested guarantees I was talking about are here as standalone commits.

ajtowns pushed a commit to ajtowns/bitcoin that referenced this pull request Oct 23, 2026
The -blocknotify command is suppressed for blocks connected during
initial block download and reindexing (it only fires once the node is
in the post-init sync state). Mention this in the option's help output.

Suggested in review of bitcoin#35518.
@sedited

sedited commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

I will take a look here soon.

Ping @willcl-ark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants