merge-script 44afed4cd9
Merge bitcoin/bitcoin#34524: refactor: [rpc] Remove confusing and brittle integral casts (take 2)
fa6801366d76a34f51a7d60be7d3710ed8e722db refactor: [rpc] Remove confusing and brittle integral casts (take 2) (MarcoFalke)

Pull request description:

  Second take for cases which I seem to have missed in commit 94ddc2dced5736612e358a3b80f2bc718fbd8161.

  When constructing an UniValue from integral values, historically (long ago), in some cases casts where needed. With the current UniValue constructor, only very few are actually needed.

  Keeping the unused casts around is:

  * confusing, because code readers do not understand why they are needed
  * brittle, because some may copy them into new places, where they will lead to hard-to-find logic bugs, such as the ones fixed in pull https://github.com/bitcoin/bitcoin/pull/34112

  So fix all issues by removing them, except for a few cases, where casting was required:
  * `static_cast<bool>(fCoinBase)`, because `bool{fCoinBase}` only works on modern compilers.

  This hardening refactor does not fix any bugs and does not change any behavior.

ACKs for top commit:
  Sjors:
    ACK fa6801366d76a34f51a7d60be7d3710ed8e722db
  sedited:
    ACK fa6801366d76a34f51a7d60be7d3710ed8e722db

Tree-SHA512: 77f03f496ea2a42987720cb4a36eb4e7a0d5b512ed7f029e41dd54c04fb4c1680f7cc13514acbc9f1bae991be4de3cf31c5a0d27c016a030f5749d132603f71e
2026-02-09 13:32:28 +00:00
..
2025-05-06 12:21:32 -07:00