#36212 cli: Display warning arrays in -getinfo

full analysis

https://github.com/bitcoin/bitcoin/pull/36212 · LittleYier · +15/-6 in 2 files, 2 commits · labels: Scripts and tools

Goal

  • Ensure bitcoin-cli -getinfo displays active node warnings properly when returned as a list
  • Prevents active warnings from being swallowed and misleading node operators

Fixes bitcoin-cli -getinfo parsing of warnings when getnetworkinfo returns a JSON array rather than a string. Array entries are joined with newlines while retaining fallback behavior for legacy string output, and the functional test helper is updated to parse multi-line warnings.

Problem: When warnings are returned as an array, bitcoin-cli -getinfo calls getValStr() which returns an empty string, causing active warnings to be swallowed and displaying Warnings: (none).

Category: RPC / REST / ZMQ (#6 of 52)

P3 · bug fix

  • P3 because it fixes a minor CLI bug where warning arrays were swallowed and shown as none
  • Prevents node operators inspecting their nodes from being misled during active warnings

Fixes a minor but visible bug in bitcoin-cli -getinfo where warnings were swallowed when formatted as a JSON array. As noted by the author, -getinfo showed '(none) even with active prerelease warnings on regtest', which misleads operators inspecting their nodes.

Membership: src/bitcoin-cli.cpp is part of the RPC category as defined by the rubric.

Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 0

Reviewability: Ready

  • Ready to review with passing CI and clean mergeable code

Clean CI and mergeable code with only fresh minor review suggestions awaiting author follow-up.

Author status: active; last addressed review comments with an update on 2026-09-12

Open concerns:

  • stickies-v suggested adopting a multi-line header layout similar to Balances and requested squashing commits.

Resolved concerns:

  • stickies-v suggested improving cli_get_info_string_to_dict and dropping redundant CLI checks in versionbits tests, which the author adopted in the second commit.

Agreement: Strong

  • Strong overall sentiment with concept support for fixing swallowed warnings
  • Concept approval thanking author for catching the bug (stickies-v)
  • Nonblocking suggestion for alternative multi-line header formatting and commit squashing (stickies-v)

Concept ACK from stickies-v; ongoing discussion on output formatting

stickies-v offered a Concept ACK and reviewed the implementation, noting they are fine with the current approach while offering minor layout alternatives.

  • stickies-v: 'Concept ACK, thanks for catching this'
  • stickies-v suggested squashing commits and proposed an optional alternative layout for warnings

Review verdicts (DrahtBot): 0

Files

16 lines under test/bench/ci.

  • test/functional/interface_bitcoin_cli.py +11/-5
  • src/bitcoin-cli.cpp +4/-1

Card

This PR fixes a bug in bitcoin-cli -getinfo where warnings returned as a JSON array were evaluated as empty strings, displaying Warnings: (none) instead of actual node warnings. The fix joins array elements with newlines while preserving backwards compatibility for legacy string responses. The issue primarily affects operators relying on -getinfo to detect active warnings. Review is ready, with Concept ACK and minor layout suggestions from stickies-v.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T16:23, confidence high, input hash 319dd9db5e1f2048