Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/design/assumeutxo.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ be of use.

Chainstate within the system goes through a number of phases when UTXO snapshots are
used, as managed by `ChainstateManager`. At various points there can be multiple
`CChainState` objects in existence to facilitate both maintaining the network tip and
`Chainstate` objects in existence to facilitate both maintaining the network tip and
performing historical validation of the assumed-valid chain.

It is worth noting that though there are multiple separate chainstates, those
Expand All @@ -53,7 +53,7 @@ data.

### "Normal" operation via initial block download

`ChainstateManager` manages a single CChainState object, for which
`ChainstateManager` manages a single Chainstate object, for which
`m_snapshot_blockhash` is null. This chainstate is (maybe obviously)
considered active. This is the "traditional" mode of operation for dashd.

Expand Down
4 changes: 2 additions & 2 deletions doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ void CTxMemPool::UpdateTransactionsFromBlock(...)

```C++
// validation.h
class CChainState
class Chainstate
{
protected:
...
Expand All @@ -1055,7 +1055,7 @@ public:
}

// validation.cpp
bool CChainState::PreciousBlock(BlockValidationState& state, CBlockIndex* pindex)
bool Chainstate::PreciousBlock(BlockValidationState& state, CBlockIndex* pindex)
{
AssertLockNotHeld(m_chainstate_mutex);
AssertLockNotHeld(::cs_main);
Expand Down
6 changes: 4 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ BITCOIN_CORE_H = \
gsl/pointers.h \
flat-database.h \
flatfile.h \
fs.h \
httprpc.h \
httpserver.h \
i2p.h \
Expand Down Expand Up @@ -398,6 +397,8 @@ BITCOIN_CORE_H = \
util/error.h \
util/fastrange.h \
util/fees.h \
util/fs.h \
util/fs_helpers.h \
util/golombrice.h \
util/hasher.h \
util/hash_type.h \
Expand Down Expand Up @@ -978,7 +979,6 @@ libbitcoin_util_a_SOURCES = \
support/lockedpool.cpp \
chainparamsbase.cpp \
clientversion.cpp \
fs.cpp \
interfaces/echo.cpp \
interfaces/handler.cpp \
interfaces/init.cpp \
Expand All @@ -996,6 +996,8 @@ libbitcoin_util_a_SOURCES = \
util/edge.cpp \
util/error.cpp \
util/fees.cpp \
util/fs.cpp \
util/fs_helpers.cpp \
util/hasher.cpp \
util/getuniquepath.cpp \
util/sock.cpp \
Expand Down
3 changes: 2 additions & 1 deletion src/addrdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include <addrman.h>
#include <chainparams.h>
#include <clientversion.h>
#include <fs.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <hash.h>
#include <logging/timer.h>
#include <netbase.h>
Expand Down
2 changes: 1 addition & 1 deletion src/addrdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#ifndef BITCOIN_ADDRDB_H
#define BITCOIN_ADDRDB_H

#include <fs.h>
#include <net_types.h> // For banmap_t
#include <univalue.h>
#include <util/fs.h>

#include <memory>
#include <optional>
Expand Down
2 changes: 1 addition & 1 deletion src/banman.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#include <addrdb.h>
#include <common/bloom.h>
#include <fs.h>
#include <net_types.h> // For banmap_t
#include <sync.h>
#include <util/fs.h>

#include <chrono>
#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <bench/bench.h>

#include <fs.h>
#include <test/util/setup_common.h>
#include <util/fs.h>
#include <util/string.h>

#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion src/bench/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BITCOIN_BENCH_BENCH_H
#define BITCOIN_BENCH_BENCH_H

#include <fs.h>
#include <util/fs.h>
#include <util/macros.h>

#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion src/bench/bench_bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <clientversion.h>
#include <crypto/sha256.h>
#include <crypto/x11/dispatch.h>
#include <fs.h>
#include <util/fs.h>
#include <util/strencodings.h>
#include <util/system.h>

Expand Down
2 changes: 1 addition & 1 deletion src/bench/load_external.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void LoadExternalBlockFile(benchmark::Bench& bench)
fclose(file);
}

CChainState& chainstate{testing_setup->m_node.chainman->ActiveChainstate()};
Chainstate& chainstate{testing_setup->m_node.chainman->ActiveChainstate()};
std::multimap<uint256, FlatFilePos> blocks_with_unknown_parent;
FlatFilePos pos;
bench.run([&] {
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <consensus/consensus.h>
#include <core_io.h>
#include <key_io.h>
#include <fs.h>
#include <util/fs.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
Expand Down
2 changes: 1 addition & 1 deletion src/chainlock/signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using node::ReadBlockFromDisk;

namespace chainlock {
ChainLockSigner::ChainLockSigner(CChainState& chainstate, const chainlock::Chainlocks& chainlocks,
ChainLockSigner::ChainLockSigner(Chainstate& chainstate, const chainlock::Chainlocks& chainlocks,
ChainlockHandler& clhandler, const llmq::CInstantSendManager& isman,
const llmq::CQuorumManager& qman, llmq::CSigningManager& sigman,
llmq::CSigSharesManager& shareman, const CMasternodeSync& mn_sync) :
Expand Down
4 changes: 2 additions & 2 deletions src/chainlock/signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChainlockHandler;
class ChainLockSigner final : public llmq::CRecoveredSigsListener, public CValidationInterface
{
private:
CChainState& m_chainstate;
Chainstate& m_chainstate;
const chainlock::Chainlocks& m_chainlocks;
ChainlockHandler& m_clhandler;
const llmq::CInstantSendManager& m_isman;
Expand Down Expand Up @@ -59,7 +59,7 @@ class ChainLockSigner final : public llmq::CRecoveredSigsListener, public CValid
ChainLockSigner() = delete;
ChainLockSigner(const ChainLockSigner&) = delete;
ChainLockSigner& operator=(const ChainLockSigner&) = delete;
explicit ChainLockSigner(CChainState& chainstate, const chainlock::Chainlocks& chainlocks,
explicit ChainLockSigner(Chainstate& chainstate, const chainlock::Chainlocks& chainlocks,
ChainlockHandler& clhandler, const llmq::CInstantSendManager& isman,
const llmq::CQuorumManager& qman, llmq::CSigningManager& sigman,
llmq::CSigSharesManager& shareman, const CMasternodeSync& mn_sync);
Expand Down
9 changes: 5 additions & 4 deletions src/coinjoin/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <netmessagemaker.h>
#include <shutdown.h>
#include <util/check.h>
#include <util/fs_helpers.h>
#include <util/moneystr.h>
#include <util/system.h>
#include <util/translation.h>
Expand Down Expand Up @@ -55,7 +56,8 @@ CCoinJoinClientManager::CCoinJoinClientManager(const std::shared_ptr<wallet::CWa

CCoinJoinClientManager::~CCoinJoinClientManager() = default;

void CCoinJoinClientManager::ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)
void CCoinJoinClientManager::ProcessMessage(CNode& peer, Chainstate& active_chainstate, CConnman& connman,
const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)
{
if (!CCoinJoinClientOptions::IsEnabled()) return;
if (!m_mn_sync.IsBlockchainSynced()) return;
Expand Down Expand Up @@ -89,7 +91,7 @@ CCoinJoinClientSession::CCoinJoinClientSession(const std::shared_ptr<CWallet>& w
m_isman{isman}
{}

void CCoinJoinClientSession::ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)
void CCoinJoinClientSession::ProcessMessage(CNode& peer, Chainstate& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)
{
if (!CCoinJoinClientOptions::IsEnabled()) return;
if (!m_mn_sync.IsBlockchainSynced()) return;
Expand Down Expand Up @@ -444,7 +446,7 @@ void CCoinJoinClientSession::ProcessPoolStateUpdate(CCoinJoinStatusUpdate psssup
// check it to make sure it's what we want, then sign it if we agree.
// If we refuse to sign, it's possible we'll be charged collateral
//
bool CCoinJoinClientSession::SignFinalTransaction(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, const CTransaction& finalTransactionNew)
bool CCoinJoinClientSession::SignFinalTransaction(CNode& peer, Chainstate& active_chainstate, CConnman& connman, const CTxMemPool& mempool, const CTransaction& finalTransactionNew)
{
if (!CCoinJoinClientOptions::IsEnabled()) return false;

Expand Down Expand Up @@ -1782,4 +1784,3 @@ void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const
}
obj.pushKV("sessions", arrSessions);
}

6 changes: 3 additions & 3 deletions src/coinjoin/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class CCoinJoinClientSession : public CCoinJoinBaseSession
void CompletedTransaction(PoolMessage nMessageID);

/// As a client, check and sign the final transaction
bool SignFinalTransaction(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, const CTransaction& finalTransactionNew) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
bool SignFinalTransaction(CNode& peer, Chainstate& active_chainstate, CConnman& connman, const CTxMemPool& mempool, const CTransaction& finalTransactionNew) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);

void RelayIn(const CCoinJoinEntry& entry, CConnman& connman) const;

Expand All @@ -128,7 +128,7 @@ class CCoinJoinClientSession : public CCoinJoinBaseSession
CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman,
const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman);

void ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv);
void ProcessMessage(CNode& peer, Chainstate& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv);

void UnlockCoins();

Expand Down Expand Up @@ -195,7 +195,7 @@ class CCoinJoinClientManager
const llmq::CInstantSendManager& isman, CoinJoinQueueManager* queueman);
~CCoinJoinClientManager();

void ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
void ProcessMessage(CNode& peer, Chainstate& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);

bool StartMixing();
void StopMixing();
Expand Down
2 changes: 1 addition & 1 deletion src/coinjoin/coinjoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ std::string CCoinJoinBaseSession::GetStateString() const
}
}

bool CCoinJoinBaseSession::IsValidInOuts(CChainState& active_chainstate, const llmq::CInstantSendManager& isman,
bool CCoinJoinBaseSession::IsValidInOuts(Chainstate& active_chainstate, const llmq::CInstantSendManager& isman,
const CTxMemPool& mempool, const std::vector<CTxIn>& vin,
const std::vector<CTxOut>& vout, PoolMessage& nMessageIDRet,
bool* fConsumeCollateralRet) const
Expand Down
4 changes: 2 additions & 2 deletions src/coinjoin/coinjoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <univalue.h>

class CChainState;
class Chainstate;
class CBLSPublicKey;
class CBlockIndex;
class ChainstateManager;
Expand Down Expand Up @@ -304,7 +304,7 @@ class CCoinJoinBaseSession

virtual void SetNull() EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin);

bool IsValidInOuts(CChainState& active_chainstate, const llmq::CInstantSendManager& isman,
bool IsValidInOuts(Chainstate& active_chainstate, const llmq::CInstantSendManager& isman,
const CTxMemPool& mempool, const std::vector<CTxIn>& vin, const std::vector<CTxOut>& vout,
PoolMessage& nMessageIDRet, bool* fConsumeCollateralRet) const;

Expand Down
4 changes: 2 additions & 2 deletions src/coinjoin/walletman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CJWalletManagerImpl final : public CJWalletManager
public:
bool hasQueue(const uint256& hash) const override;
CCoinJoinClientManager* getClient(const std::string& name) override EXCLUSIVE_LOCKS_REQUIRED(!cs_wallet_manager_map);
MessageProcessingResult processMessage(CNode& peer, CChainState& chainstate, CConnman& connman, CTxMemPool& mempool,
MessageProcessingResult processMessage(CNode& peer, Chainstate& chainstate, CConnman& connman, CTxMemPool& mempool,
std::string_view msg_type, CDataStream& vRecv) override EXCLUSIVE_LOCKS_REQUIRED(!cs_ProcessDSQueue, !cs_wallet_manager_map);
std::optional<CCoinJoinQueue> getQueueFromHash(const uint256& hash) const override;
std::optional<int> getQueueSize() const override;
Expand Down Expand Up @@ -202,7 +202,7 @@ void CJWalletManagerImpl::DoMaintenance(CConnman& connman)
}
}

MessageProcessingResult CJWalletManagerImpl::processMessage(CNode& pfrom, CChainState& chainstate, CConnman& connman,
MessageProcessingResult CJWalletManagerImpl::processMessage(CNode& pfrom, Chainstate& chainstate, CConnman& connman,
CTxMemPool& mempool, std::string_view msg_type,
CDataStream& vRecv)
{
Expand Down
4 changes: 2 additions & 2 deletions src/coinjoin/walletman.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <string_view>

class CBlockIndex;
class CChainState;
class Chainstate;
class CCoinJoinClientManager;
class CCoinJoinQueue;
class CConnman;
Expand Down Expand Up @@ -48,7 +48,7 @@ class CJWalletManager : public CValidationInterface
public:
virtual bool hasQueue(const uint256& hash) const = 0;
virtual CCoinJoinClientManager* getClient(const std::string& name) = 0;
virtual MessageProcessingResult processMessage(CNode& peer, CChainState& chainstate, CConnman& connman,
virtual MessageProcessingResult processMessage(CNode& peer, Chainstate& chainstate, CConnman& connman,
CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) = 0;
virtual std::optional<CCoinJoinQueue> getQueueFromHash(const uint256& hash) const = 0;
virtual std::optional<int> getQueueSize() const = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/dbwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

#include <dbwrapper.h>

#include <fs.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <logging.h>
#include <random.h>
#include <util/strencodings.h>
Expand Down
2 changes: 1 addition & 1 deletion src/dbwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

#include <assert.h>
#include <clientversion.h>
#include <fs.h>
#include <logging.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <util/fs.h>

#include <sys/types.h>

Expand Down
2 changes: 1 addition & 1 deletion src/flat-database.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <clientversion.h>
#include <chainparams.h>
#include <fs.h>
#include <util/fs.h>
#include <hash.h>
#include <streams.h>
#include <util/system.h>
Expand Down
2 changes: 1 addition & 1 deletion src/flatfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <flatfile.h>
#include <logging.h>
#include <tinyformat.h>
#include <util/system.h>
#include <util/fs_helpers.h>

FlatFileSeq::FlatFileSeq(fs::path dir, const char* prefix, size_t chunk_size) :
m_dir(std::move(dir)),
Expand Down
2 changes: 1 addition & 1 deletion src/flatfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include <string>

#include <fs.h>
#include <serialize.h>
#include <util/fs.h>

struct FlatFilePos
{
Expand Down
2 changes: 1 addition & 1 deletion src/i2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <compat/compat.h>
#include <compat/endian.h>
#include <crypto/sha256.h>
#include <fs.h>
#include <i2p.h>
#include <logging.h>
#include <netaddress.h>
#include <netbase.h>
#include <random.h>
#include <sync.h>
#include <tinyformat.h>
#include <util/fs.h>
#include <util/readwritefile.h>
#include <util/sock.h>
#include <util/spanparsing.h>
Expand Down
2 changes: 1 addition & 1 deletion src/i2p.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#define BITCOIN_I2P_H

#include <compat/compat.h>
#include <fs.h>
#include <netaddress.h>
#include <netbase.h>
#include <sync.h>
#include <util/fs.h>
#include <util/sock.h>
#include <util/threadinterrupt.h>

Expand Down
2 changes: 1 addition & 1 deletion src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ void BaseIndex::Interrupt()
m_interrupt();
}

bool BaseIndex::Start(CChainState& active_chainstate)
bool BaseIndex::Start(Chainstate& active_chainstate)
{
m_chainstate = &active_chainstate;
// Need to register this ValidationInterface before running Init(), so that
Expand Down
Loading
Loading