HomePhabricator

coinstats: Extract in-members to in-params, return purely out-param CCoinsStats

Description

coinstats: Extract in-members to in-params, return purely out-param CCoinsStats

Summary:
Currently, CCoinsStats is a struct with both in-params and out-params
where the hash_type and index_requested members are the only in-params.

Move the in-params out of the struct, so as to make CCoinsStats a pure out-param struct.

Modify GetUTXOStats to return an optional CCoinsStats instead of a status bool. Callers are modified accordingly.

In rpc/blockchain.cpp, we discover that GetUTXOStats' status bool when
getting UTXO stats for pprev was not checked for error. We fix this as
well.

This is a partial backport of core#24410
https://github.com/bitcoin/bitcoin/pull/24410/commits/a789f3f2b878e1236f8e043a8bb1ffb1afc1b673
https://github.com/bitcoin/bitcoin/pull/24410/commits/46eb9fc56a296a2acea10ec7e5bf7b1827f73c45
https://github.com/bitcoin/bitcoin/pull/24410/commits/524463daf6a10b20a4e20116a68101a684929eda

Depends on D14671

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14672

Details

Provenance
Carl Dong <contact@carldong.me>Authored on Feb 14 2022, 00:27
PiRKCommitted on Oct 26 2023, 11:39
PiRKPushed on Oct 26 2023, 11:39
Reviewer
Restricted Project
Differential Revision
D14672: coinstats: Extract in-members to in-params, return purely out-param CCoinsStats
Parents
rABCc4c53baa3851: fuzz: Remove useless GetUTXOStats fuzz case
Branches
Unknown
Tags
Unknown