rpc, wallet: Keep the same response from `RPCHelpMan setwalletflag()` regardless of whether the flag is false or true #24868

pull w0xlt wants to merge 1 commits into bitcoin:master from w0xlt:set_wallet_flag_fix changing 1 files +2 −0
  1. w0xlt commented at 6:17 AM on April 16, 2022: contributor

    RPCHelpMan setwalletflag() returns a different structure in response according to the value of the flag. This causes an error since the structure is well defined in RPCResult. This PR changes the answer to use the same structure in both cases.

    In master branch:

    $ bitcoin-cli -regtest setwalletflag "avoid_reuse" true
    {
      "flag_name": "avoid_reuse",
      "flag_state": true,
      "warnings": "You need to rescan the blockchain in order to correctly mark used destinations in the past. Until this is done, some destinations may be considered unused, even if the opposite is the case."
    }
    
    $ bitcoin-cli -regtest setwalletflag "avoid_reuse" false
    error code: -1
    error message:
    Internal bug detected: 'std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [ret](const RPCResult& res) { return res.MatchesType(ret); })'
    rpc/util.cpp:587 (HandleRequest)
    You may report this issue here: https://github.com/bitcoin/bitcoin/issues
    

    In PR branch:

    $ bitcoin-cli -regtest setwalletflag "avoid_reuse" true
    {
      "flag_name": "avoid_reuse",
      "flag_state": true,
      "warnings": "You need to rescan the blockchain in order to correctly mark used destinations in the past. Until this is done, some destinations may be considered unused, even if the opposite is the case."
    }
    
    $ bitcoin-cli -regtest setwalletflag "avoid_reuse" false
    {
      "flag_name": "avoid_reuse",
      "flag_state": false,
      "warnings": ""
    }
    
  2. Keep the same response regardless of whether the flag is false or true
    `RPCHelpMan setwalletflag()` returns a different structure in response
    according to the value of the flag. This causes an error since the
    structure is well defined in RPCResult.
    This commit changes the answer to use the same structure in both cases.
    500f7b6457
  3. MarcoFalke commented at 7:09 AM on April 16, 2022: member
  4. w0xlt commented at 7:15 AM on April 16, 2022: contributor
  5. w0xlt closed this on Apr 16, 2022

  6. DrahtBot locked this on Apr 16, 2023
Contributors

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-04-21 00:14 UTC

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