mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
refactor: Convert ChainstateRole enum to struct
Change ChainstateRole parameter passed to wallets and indexes. Wallets and indexes need to know whether chainstate is historical and whether it is fully validated. They should not be aware of the assumeutxo snapshot validation process.
This commit is contained in:
@@ -5,11 +5,14 @@
|
||||
#include <chain.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <kernel/types.h>
|
||||
#include <sync.h>
|
||||
#include <uint256.h>
|
||||
|
||||
class CBlock;
|
||||
|
||||
using kernel::ChainstateRole;
|
||||
|
||||
namespace kernel {
|
||||
interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* index, const CBlock* data)
|
||||
{
|
||||
@@ -25,14 +28,15 @@ interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* index, const CBlock* data
|
||||
info.data = data;
|
||||
return info;
|
||||
}
|
||||
} // namespace kernel
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const ChainstateRole& role) {
|
||||
switch(role) {
|
||||
case ChainstateRole::NORMAL: os << "normal"; break;
|
||||
case ChainstateRole::ASSUMEDVALID: os << "assumedvalid"; break;
|
||||
case ChainstateRole::BACKGROUND: os << "background"; break;
|
||||
default: os.setstate(std::ios_base::failbit);
|
||||
if (!role.validated) {
|
||||
os << "assumedvalid";
|
||||
} else if (role.historical) {
|
||||
os << "background";
|
||||
} else {
|
||||
os << "normal";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
} // namespace kernel
|
||||
|
||||
Reference in New Issue
Block a user