coins: make Coin::fCoinBase a bool

The coinbase flag is semantically boolean but was stored as an unsigned bitfield. Store it as a `bool : 1` bitfield to better reflect intent and avoid relying on implicit integral conversions at call sites.

Update users to prefer `Coin::IsCoinBase()` and to pass explicit `true`/`false` values where appropriate.
This commit is contained in:
Lőrinc
2024-12-09 13:25:25 +01:00
parent 5f6bfa3649
commit 1f309d1aa2
6 changed files with 10 additions and 10 deletions

View File

@@ -480,7 +480,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
ScriptToUniv(prev_txout.scriptPubKey, /*out=*/o_script_pub_key, /*include_hex=*/true, /*include_address=*/true);
UniValue p(UniValue::VOBJ);
p.pushKV("generated", static_cast<bool>(prev_coin.fCoinBase));
p.pushKV("generated", prev_coin.IsCoinBase());
p.pushKV("height", prev_coin.nHeight);
p.pushKV("value", ValueFromAmount(prev_txout.nValue));
p.pushKV("scriptPubKey", std::move(o_script_pub_key));