cli: Display warning arrays in -getinfo #36212

pull LittleYier wants to merge 2 commits into bitcoin:master from LittleYier:cli-fix-getinfo-warnings changing 2 files +15 −6
  1. LittleYier commented at 10:55 PM on September 9, 2026: contributor

    -getinfo swallowed warnings when getnetworkinfo returns an array instead of string, showing (none) even with active prerelease warnings on regtest.

    Just join array items with newline and keep the fallback for legacy strings / empty cases. Threw together a quick test to cover it.

    Tested on m1 mac, regtest warning shows up fine now and py tests pass.

  2. cli: Display warning arrays in -getinfo
    Render all warnings returned by getnetworkinfo, separated by newlines. Preserve legacy string responses and the empty-warning fallback.
    045bb80f3d
  3. LittleYier requested review from Copilot on Sep 9, 2026
  4. DrahtBot added the label Scripts and tools on Sep 9, 2026
  5. DrahtBot commented at 10:55 PM on September 9, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36212.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    Concept ACK stickies-v

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. ?
    copilot_work_started LittleYier
  7. Copilot commented at 10:58 PM on September 9, 2026: none

    🟢 Approval recommended

    All reviewed changes are covered and no blocking issues remain.

    <details> <summary>Pull request overview</summary>

    Updates bitcoin-cli -getinfo to display warning arrays while retaining legacy string handling.

    Changes:

    • Joins warning arrays with newlines.
    • Preserves (none) fallback behavior.
    • Adds coverage for array, string, and versionbits warnings.

      </details>

    <details> <summary>File summaries</summary>

    File Description
    test/functional/interface_bitcoin_cli.py Tests array and legacy warning formats.
    test/functional/feature_versionbits_warning.py Verifies active warnings appear in -getinfo.
    src/bitcoin-cli.cpp Formats warning arrays and legacy strings.

    </details>

    <details> <summary>Review details</summary>

    • Files reviewed: 3/3 changed files
    • Comments generated: 0
    • Review effort level: Lite

      </details>


    💡 <a href="/bitcoin/bitcoin/new/master?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>

  8. sedited requested review from stickies-v on Sep 10, 2026
  9. in test/functional/interface_bitcoin_cli.py:243 in 045bb80f3d
     238 | @@ -239,6 +239,13 @@ def run_test(self):
     239 |          assert_equal(cli_get_info['Proxies'], network_info['networks'][0]['proxy'])
     240 |          assert_equal(Decimal(cli_get_info['Difficulty']), blockchain_info['difficulty'])
     241 |          assert_equal(cli_get_info['Chain'], blockchain_info['chain'])
     242 | +        expected_warnings = "\n".join(network_info['warnings']) or "(none)"
     243 | +        assert cli_get_info_string.endswith(f"Warnings: {expected_warnings}")
    


    stickies-v commented at 10:36 AM on September 10, 2026:

    Would it be better to update cli_get_info_string_to_dict to properly parse Warnings, like we already do for Balances?

  10. in test/functional/interface_bitcoin_cli.py:245 in 045bb80f3d
     238 | @@ -239,6 +239,13 @@ def run_test(self):
     239 |          assert_equal(cli_get_info['Proxies'], network_info['networks'][0]['proxy'])
     240 |          assert_equal(Decimal(cli_get_info['Difficulty']), blockchain_info['difficulty'])
     241 |          assert_equal(cli_get_info['Chain'], blockchain_info['chain'])
     242 | +        expected_warnings = "\n".join(network_info['warnings']) or "(none)"
     243 | +        assert cli_get_info_string.endswith(f"Warnings: {expected_warnings}")
     244 | +
     245 | +        self.log.info("Test -getinfo with deprecated string warnings")
    


    stickies-v commented at 10:59 AM on September 10, 2026:

    This doesn't seem all that relevant to testing the cli, makes sense to drop I think?

  11. in test/functional/feature_versionbits_warning.py:117 in 045bb80f3d
     113 | @@ -114,6 +114,9 @@ def run_test(self):
     114 |          # Check that get*info() shows the versionbits unknown rules warning
     115 |          assert WARN_UNKNOWN_RULES_ACTIVE in ",".join(node.getmininginfo()["warnings"])
     116 |          assert WARN_UNKNOWN_RULES_ACTIVE in ",".join(node.getnetworkinfo()["warnings"])
     117 | +        if self.is_cli_compiled():
    


    stickies-v commented at 11:13 AM on September 10, 2026:

    I don't think testing the cli is relevant in this versionbits warning test?

  12. stickies-v commented at 11:16 AM on September 10, 2026: contributor

    Concept ACK, thanks for catching this

  13. test: Parse getinfo warnings in CLI helper
    Parse the complete final Warnings section after removing ANSI codes, preserving multiline messages and colons. Compare warnings through the existing dictionary helper.
    
    Keep CLI coverage in the CLI test by dropping the separate deprecated-mode restart and the CLI assertion in the versionbits test.
    59d0d24d6c
  14. LittleYier commented at 1:31 PM on September 12, 2026: contributor

    Pushed in 59d0d24 1.Tweaked the helper to grab the whole warnings section so colons and newlines don't get chopped. 2. Dropped the extra restart + cli check in versionbits test as suggested. Thanks for the quick review!


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-13 02:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me