mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: migrate some Dash code to use ChainstateManager::ProcessTransaction
This commit is contained in:
parent
c8571c0956
commit
0073b66aaa
@ -793,7 +793,7 @@ bool CCoinJoinClientManager::CheckAutomaticBackup()
|
|||||||
//
|
//
|
||||||
// Passively run mixing in the background to mix funds based on the given configuration.
|
// Passively run mixing in the background to mix funds based on the given configuration.
|
||||||
//
|
//
|
||||||
bool CCoinJoinClientSession::DoAutomaticDenominating(CChainState& active_chainstate, CConnman& connman, CTxMemPool& mempool, bool fDryRun)
|
bool CCoinJoinClientSession::DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun)
|
||||||
{
|
{
|
||||||
if (m_is_masternode) return false; // no client-side mixing on masternodes
|
if (m_is_masternode) return false; // no client-side mixing on masternodes
|
||||||
if (nState != POOL_STATE_IDLE) return false;
|
if (nState != POOL_STATE_IDLE) return false;
|
||||||
@ -946,7 +946,7 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(CChainState& active_chainst
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!CoinJoin::IsCollateralValid(active_chainstate, mempool, CTransaction(txMyCollateral))) {
|
if (!CoinJoin::IsCollateralValid(chainman, mempool, CTransaction(txMyCollateral))) {
|
||||||
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::DoAutomaticDenominating -- invalid collateral, recreating...\n");
|
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::DoAutomaticDenominating -- invalid collateral, recreating...\n");
|
||||||
if (!CreateCollateralTransaction(txMyCollateral, strReason)) {
|
if (!CreateCollateralTransaction(txMyCollateral, strReason)) {
|
||||||
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::DoAutomaticDenominating -- create collateral error: %s\n", strReason);
|
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::DoAutomaticDenominating -- create collateral error: %s\n", strReason);
|
||||||
@ -973,7 +973,7 @@ bool CCoinJoinClientSession::DoAutomaticDenominating(CChainState& active_chainst
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCoinJoinClientManager::DoAutomaticDenominating(CChainState& active_chainstate, CConnman& connman, CTxMemPool& mempool, bool fDryRun)
|
bool CCoinJoinClientManager::DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun)
|
||||||
{
|
{
|
||||||
if (m_is_masternode) return false; // no client-side mixing on masternodes
|
if (m_is_masternode) return false; // no client-side mixing on masternodes
|
||||||
if (!CCoinJoinClientOptions::IsEnabled() || !IsMixing()) return false;
|
if (!CCoinJoinClientOptions::IsEnabled() || !IsMixing()) return false;
|
||||||
@ -1016,7 +1016,7 @@ bool CCoinJoinClientManager::DoAutomaticDenominating(CChainState& active_chainst
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fResult &= session.DoAutomaticDenominating(active_chainstate, connman, mempool, fDryRun);
|
fResult &= session.DoAutomaticDenominating(chainman, connman, mempool, fDryRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fResult;
|
return fResult;
|
||||||
@ -1864,7 +1864,7 @@ void CCoinJoinClientQueueManager::DoMaintenance()
|
|||||||
CheckQueue();
|
CheckQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoinJoinClientManager::DoMaintenance(CChainState& active_chainstate, CConnman& connman, CTxMemPool& mempool)
|
void CCoinJoinClientManager::DoMaintenance(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool)
|
||||||
{
|
{
|
||||||
if (!CCoinJoinClientOptions::IsEnabled()) return;
|
if (!CCoinJoinClientOptions::IsEnabled()) return;
|
||||||
if (m_is_masternode) return; // no client-side mixing on masternodes
|
if (m_is_masternode) return; // no client-side mixing on masternodes
|
||||||
@ -1878,7 +1878,7 @@ void CCoinJoinClientManager::DoMaintenance(CChainState& active_chainstate, CConn
|
|||||||
CheckTimeout();
|
CheckTimeout();
|
||||||
ProcessPendingDsaRequest(connman);
|
ProcessPendingDsaRequest(connman);
|
||||||
if (nDoAutoNextRun == nTick) {
|
if (nDoAutoNextRun == nTick) {
|
||||||
DoAutomaticDenominating(active_chainstate, connman, mempool);
|
DoAutomaticDenominating(chainman, connman, mempool);
|
||||||
nDoAutoNextRun = nTick + COINJOIN_AUTO_TIMEOUT_MIN + GetRandInt(COINJOIN_AUTO_TIMEOUT_MAX - COINJOIN_AUTO_TIMEOUT_MIN);
|
nDoAutoNextRun = nTick + COINJOIN_AUTO_TIMEOUT_MIN + GetRandInt(COINJOIN_AUTO_TIMEOUT_MAX - COINJOIN_AUTO_TIMEOUT_MIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1930,7 +1930,7 @@ void CoinJoinWalletManager::DoMaintenance()
|
|||||||
{
|
{
|
||||||
LOCK(cs_wallet_manager_map);
|
LOCK(cs_wallet_manager_map);
|
||||||
for (auto& [_, clientman] : m_wallet_manager_map) {
|
for (auto& [_, clientman] : m_wallet_manager_map) {
|
||||||
clientman->DoMaintenance(m_chainstate, m_connman, m_mempool);
|
clientman->DoMaintenance(m_chainman, m_connman, m_mempool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,10 @@ class CCoinJoinClientQueueManager;
|
|||||||
class CConnman;
|
class CConnman;
|
||||||
class CDeterministicMN;
|
class CDeterministicMN;
|
||||||
class CDeterministicMNManager;
|
class CDeterministicMNManager;
|
||||||
class CNode;
|
class ChainstateManager;
|
||||||
class CMasternodeMetaMan;
|
class CMasternodeMetaMan;
|
||||||
class CMasternodeSync;
|
class CMasternodeSync;
|
||||||
|
class CNode;
|
||||||
class CoinJoinWalletManager;
|
class CoinJoinWalletManager;
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
|
|
||||||
@ -74,9 +75,9 @@ public:
|
|||||||
using wallet_name_cjman_map = std::map<const std::string, std::unique_ptr<CCoinJoinClientManager>>;
|
using wallet_name_cjman_map = std::map<const std::string, std::unique_ptr<CCoinJoinClientManager>>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CoinJoinWalletManager(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool,
|
CoinJoinWalletManager(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, const CTxMemPool& mempool,
|
||||||
const CMasternodeSync& mn_sync, const std::unique_ptr<CCoinJoinClientQueueManager>& queueman, bool is_masternode)
|
const CMasternodeSync& mn_sync, const std::unique_ptr<CCoinJoinClientQueueManager>& queueman, bool is_masternode)
|
||||||
: m_chainstate(chainstate), m_connman(connman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mempool(mempool), m_mn_sync(mn_sync),
|
: m_chainman(chainman), m_connman(connman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mempool(mempool), m_mn_sync(mn_sync),
|
||||||
m_queueman(queueman), m_is_masternode{is_masternode}
|
m_queueman(queueman), m_is_masternode{is_masternode}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -112,11 +113,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CChainState& m_chainstate;
|
ChainstateManager& m_chainman;
|
||||||
CConnman& m_connman;
|
CConnman& m_connman;
|
||||||
CDeterministicMNManager& m_dmnman;
|
CDeterministicMNManager& m_dmnman;
|
||||||
CMasternodeMetaMan& m_mn_metaman;
|
CMasternodeMetaMan& m_mn_metaman;
|
||||||
CTxMemPool& m_mempool;
|
const CTxMemPool& m_mempool;
|
||||||
const CMasternodeSync& m_mn_sync;
|
const CMasternodeSync& m_mn_sync;
|
||||||
const std::unique_ptr<CCoinJoinClientQueueManager>& m_queueman;
|
const std::unique_ptr<CCoinJoinClientQueueManager>& m_queueman;
|
||||||
|
|
||||||
@ -202,7 +203,7 @@ public:
|
|||||||
bool GetMixingMasternodeInfo(CDeterministicMNCPtr& ret) const;
|
bool GetMixingMasternodeInfo(CDeterministicMNCPtr& ret) const;
|
||||||
|
|
||||||
/// Passively run mixing in the background according to the configuration in settings
|
/// Passively run mixing in the background according to the configuration in settings
|
||||||
bool DoAutomaticDenominating(CChainState& active_chainstate, CConnman& connman, CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
|
bool DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
|
||||||
|
|
||||||
/// As a client, submit part of a future mixing transaction to a Masternode to start the process
|
/// As a client, submit part of a future mixing transaction to a Masternode to start the process
|
||||||
bool SubmitDenominate(CConnman& connman);
|
bool SubmitDenominate(CConnman& connman);
|
||||||
@ -310,7 +311,7 @@ public:
|
|||||||
bool GetMixingMasternodesInfo(std::vector<CDeterministicMNCPtr>& vecDmnsRet) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
bool GetMixingMasternodesInfo(std::vector<CDeterministicMNCPtr>& vecDmnsRet) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
||||||
|
|
||||||
/// Passively run mixing in the background according to the configuration in settings
|
/// Passively run mixing in the background according to the configuration in settings
|
||||||
bool DoAutomaticDenominating(CChainState& active_chainstate, CConnman& connman, CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
bool DoAutomaticDenominating(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
||||||
|
|
||||||
bool TrySubmitDenominate(const CService& mnAddr, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
bool TrySubmitDenominate(const CService& mnAddr, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
||||||
bool MarkAlreadyJoinedQueueAsTried(CCoinJoinQueue& dsq) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
bool MarkAlreadyJoinedQueueAsTried(CCoinJoinQueue& dsq) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
||||||
@ -326,7 +327,7 @@ public:
|
|||||||
|
|
||||||
void UpdatedBlockTip(const CBlockIndex* pindex);
|
void UpdatedBlockTip(const CBlockIndex* pindex);
|
||||||
|
|
||||||
void DoMaintenance(CChainState& active_chainstate, CConnman& connman, CTxMemPool& mempool) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
void DoMaintenance(ChainstateManager& chainman, CConnman& connman, const CTxMemPool& mempool) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
||||||
|
|
||||||
void GetJsonInfo(UniValue& obj) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
void GetJsonInfo(UniValue& obj) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
|
||||||
};
|
};
|
||||||
|
@ -308,10 +308,10 @@ bool CCoinJoinBaseSession::IsValidInOuts(CChainState& active_chainstate, const C
|
|||||||
|
|
||||||
// Responsibility for checking fee sanity is moved from the mempool to the client (BroadcastTransaction)
|
// Responsibility for checking fee sanity is moved from the mempool to the client (BroadcastTransaction)
|
||||||
// but CoinJoin still requires ATMP with fee sanity checks so we need to implement them separately
|
// but CoinJoin still requires ATMP with fee sanity checks so we need to implement them separately
|
||||||
bool ATMPIfSaneFee(CChainState& active_chainstate, CTxMemPool& pool, const CTransactionRef &tx, bool test_accept) {
|
bool ATMPIfSaneFee(ChainstateManager& chainman, const CTransactionRef &tx, bool test_accept) {
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
||||||
const MempoolAcceptResult result = AcceptToMemoryPool(active_chainstate, pool, tx, /* bypass_limits */ false, /* test_accept */ true);
|
const MempoolAcceptResult result = chainman.ProcessTransaction(tx, /*test_accept=*/true);
|
||||||
if (result.m_result_type != MempoolAcceptResult::ResultType::VALID) {
|
if (result.m_result_type != MempoolAcceptResult::ResultType::VALID) {
|
||||||
/* Fetch fee and fast-fail if ATMP fails regardless */
|
/* Fetch fee and fast-fail if ATMP fails regardless */
|
||||||
return false;
|
return false;
|
||||||
@ -322,11 +322,11 @@ bool ATMPIfSaneFee(CChainState& active_chainstate, CTxMemPool& pool, const CTran
|
|||||||
/* Don't re-run ATMP if only doing test run */
|
/* Don't re-run ATMP if only doing test run */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return AcceptToMemoryPool(active_chainstate, pool, tx, /* bypass_limits */ false, test_accept).m_result_type == MempoolAcceptResult::ResultType::VALID;
|
return chainman.ProcessTransaction(tx, test_accept).m_result_type == MempoolAcceptResult::ResultType::VALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to make sure the collateral provided by the client is valid
|
// check to make sure the collateral provided by the client is valid
|
||||||
bool CoinJoin::IsCollateralValid(CChainState& active_chainstate, CTxMemPool& mempool, const CTransaction& txCollateral)
|
bool CoinJoin::IsCollateralValid(ChainstateManager& chainman, const CTxMemPool& mempool, const CTransaction& txCollateral)
|
||||||
{
|
{
|
||||||
if (txCollateral.vout.empty()) return false;
|
if (txCollateral.vout.empty()) return false;
|
||||||
if (txCollateral.nLockTime != 0) return false;
|
if (txCollateral.nLockTime != 0) return false;
|
||||||
@ -352,7 +352,7 @@ bool CoinJoin::IsCollateralValid(CChainState& active_chainstate, CTxMemPool& mem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nValueIn += mempoolTx->vout[txin.prevout.n].nValue;
|
nValueIn += mempoolTx->vout[txin.prevout.n].nValue;
|
||||||
} else if (GetUTXOCoin(active_chainstate, txin.prevout, coin)) {
|
} else if (GetUTXOCoin(chainman.ActiveChainstate(), txin.prevout, coin)) {
|
||||||
nValueIn += coin.out.nValue;
|
nValueIn += coin.out.nValue;
|
||||||
} else {
|
} else {
|
||||||
LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- Unknown inputs in collateral transaction, txCollateral=%s", txCollateral.ToString()); /* Continued */
|
LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- Unknown inputs in collateral transaction, txCollateral=%s", txCollateral.ToString()); /* Continued */
|
||||||
@ -370,8 +370,8 @@ bool CoinJoin::IsCollateralValid(CChainState& active_chainstate, CTxMemPool& mem
|
|||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
if (!ATMPIfSaneFee(active_chainstate, mempool, MakeTransactionRef(txCollateral), /*test_accept=*/true)) {
|
if (!ATMPIfSaneFee(chainman, MakeTransactionRef(txCollateral), /*test_accept=*/true)) {
|
||||||
LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- didn't pass AcceptToMemoryPool()\n");
|
LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- didn't pass ATMPIfSaneFee()\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ class CChainState;
|
|||||||
class CConnman;
|
class CConnman;
|
||||||
class CBLSPublicKey;
|
class CBLSPublicKey;
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
|
class ChainstateManager;
|
||||||
class CMasternodeSync;
|
class CMasternodeSync;
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
class TxValidationState;
|
class TxValidationState;
|
||||||
@ -368,7 +369,7 @@ namespace CoinJoin
|
|||||||
constexpr CAmount GetMaxPoolAmount() { return COINJOIN_ENTRY_MAX_SIZE * vecStandardDenominations.front(); }
|
constexpr CAmount GetMaxPoolAmount() { return COINJOIN_ENTRY_MAX_SIZE * vecStandardDenominations.front(); }
|
||||||
|
|
||||||
/// If the collateral is valid given by a client
|
/// If the collateral is valid given by a client
|
||||||
bool IsCollateralValid(CChainState& active_chainstate, CTxMemPool& mempool, const CTransaction& txCollateral);
|
bool IsCollateralValid(ChainstateManager& chainman, const CTxMemPool& mempool, const CTransaction& txCollateral);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +403,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ATMPIfSaneFee(CChainState& active_chainstate, CTxMemPool& pool,
|
bool ATMPIfSaneFee(ChainstateManager& chainman, const CTransactionRef &tx, bool test_accept = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
const CTransactionRef &tx, bool test_accept = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
|
||||||
|
|
||||||
#endif // BITCOIN_COINJOIN_COINJOIN_H
|
#endif // BITCOIN_COINJOIN_COINJOIN_H
|
||||||
|
@ -9,20 +9,20 @@
|
|||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
#include <coinjoin/server.h>
|
#include <coinjoin/server.h>
|
||||||
|
|
||||||
CJContext::CJContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman,
|
CJContext::CJContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman,
|
||||||
CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool,
|
CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool,
|
||||||
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
|
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
|
||||||
std::unique_ptr<PeerManager>& peerman, bool relay_txes) :
|
std::unique_ptr<PeerManager>& peerman, bool relay_txes) :
|
||||||
dstxman{std::make_unique<CDSTXManager>()},
|
dstxman{std::make_unique<CDSTXManager>()},
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
walletman{std::make_unique<CoinJoinWalletManager>(chainstate, connman, dmnman, mn_metaman, mempool, mn_sync,
|
walletman{std::make_unique<CoinJoinWalletManager>(chainman, connman, dmnman, mn_metaman, mempool, mn_sync,
|
||||||
queueman, /* is_masternode = */ mn_activeman != nullptr)},
|
queueman, /* is_masternode = */ mn_activeman != nullptr)},
|
||||||
queueman{relay_txes
|
queueman{relay_txes
|
||||||
? std::make_unique<CCoinJoinClientQueueManager>(connman, peerman, *walletman, dmnman, mn_metaman,
|
? std::make_unique<CCoinJoinClientQueueManager>(connman, peerman, *walletman, dmnman, mn_metaman,
|
||||||
mn_sync, /* is_masternode = */ mn_activeman != nullptr)
|
mn_sync, /* is_masternode = */ mn_activeman != nullptr)
|
||||||
: nullptr},
|
: nullptr},
|
||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
server{std::make_unique<CCoinJoinServer>(chainstate, connman, dmnman, *dstxman, mn_metaman, mempool, mn_activeman,
|
server{std::make_unique<CCoinJoinServer>(chainman, connman, dmnman, *dstxman, mn_metaman, mempool, mn_activeman,
|
||||||
mn_sync, peerman)}
|
mn_sync, peerman)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
class CActiveMasternodeManager;
|
class CActiveMasternodeManager;
|
||||||
class CBlockPolicyEstimator;
|
class CBlockPolicyEstimator;
|
||||||
class CChainState;
|
|
||||||
class CCoinJoinServer;
|
class CCoinJoinServer;
|
||||||
class CConnman;
|
class CConnman;
|
||||||
class CDeterministicMNManager;
|
class CDeterministicMNManager;
|
||||||
class CDSTXManager;
|
class CDSTXManager;
|
||||||
|
class ChainstateManager;
|
||||||
class CMasternodeMetaMan;
|
class CMasternodeMetaMan;
|
||||||
class CMasternodeSync;
|
class CMasternodeSync;
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
@ -31,7 +31,7 @@ class CoinJoinWalletManager;
|
|||||||
struct CJContext {
|
struct CJContext {
|
||||||
CJContext() = delete;
|
CJContext() = delete;
|
||||||
CJContext(const CJContext&) = delete;
|
CJContext(const CJContext&) = delete;
|
||||||
CJContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman,
|
CJContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman,
|
||||||
CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman,
|
CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman,
|
||||||
const CMasternodeSync& mn_sync, std::unique_ptr<PeerManager>& peerman, bool relay_txes);
|
const CMasternodeSync& mn_sync, std::unique_ptr<PeerManager>& peerman, bool relay_txes);
|
||||||
~CJContext();
|
~CJContext();
|
||||||
|
@ -331,8 +331,8 @@ void CCoinJoinServer::CommitFinalTransaction()
|
|||||||
// See if the transaction is valid
|
// See if the transaction is valid
|
||||||
TRY_LOCK(cs_main, lockMain);
|
TRY_LOCK(cs_main, lockMain);
|
||||||
mempool.PrioritiseTransaction(hashTx, 0.1 * COIN);
|
mempool.PrioritiseTransaction(hashTx, 0.1 * COIN);
|
||||||
if (!lockMain || !ATMPIfSaneFee(m_chainstate, mempool, finalTransaction)) {
|
if (!lockMain || !ATMPIfSaneFee(m_chainman, finalTransaction)) {
|
||||||
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- AcceptToMemoryPool() error: Transaction not valid\n");
|
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- ATMPIfSaneFee() error: Transaction not valid\n");
|
||||||
WITH_LOCK(cs_coinjoin, SetNull());
|
WITH_LOCK(cs_coinjoin, SetNull());
|
||||||
// not much we can do in this case, just notify clients
|
// not much we can do in this case, just notify clients
|
||||||
RelayCompletedTransaction(ERR_INVALID_TX);
|
RelayCompletedTransaction(ERR_INVALID_TX);
|
||||||
@ -463,8 +463,8 @@ void CCoinJoinServer::ChargeRandomFees() const
|
|||||||
void CCoinJoinServer::ConsumeCollateral(const CTransactionRef& txref) const
|
void CCoinJoinServer::ConsumeCollateral(const CTransactionRef& txref) const
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
if (!ATMPIfSaneFee(m_chainstate, mempool, txref, false /* bypass_limits */)) {
|
if (!ATMPIfSaneFee(m_chainman, txref)) {
|
||||||
LogPrint(BCLog::COINJOIN, "%s -- AcceptToMemoryPool failed\n", __func__);
|
LogPrint(BCLog::COINJOIN, "%s -- ATMPIfSaneFee failed\n", __func__);
|
||||||
} else {
|
} else {
|
||||||
Assert(m_peerman)->RelayTransaction(txref->GetHash());
|
Assert(m_peerman)->RelayTransaction(txref->GetHash());
|
||||||
LogPrint(BCLog::COINJOIN, "%s -- Collateral was consumed\n", __func__);
|
LogPrint(BCLog::COINJOIN, "%s -- Collateral was consumed\n", __func__);
|
||||||
@ -582,7 +582,7 @@ bool CCoinJoinServer::AddEntry(const CCoinJoinEntry& entry, PoolMessage& nMessag
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoinJoin::IsCollateralValid(m_chainstate, mempool, *entry.txCollateral)) {
|
if (!CoinJoin::IsCollateralValid(m_chainman, mempool, *entry.txCollateral)) {
|
||||||
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- ERROR: collateral not valid!\n", __func__);
|
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- ERROR: collateral not valid!\n", __func__);
|
||||||
nMessageIDRet = ERR_INVALID_COLLATERAL;
|
nMessageIDRet = ERR_INVALID_COLLATERAL;
|
||||||
return false;
|
return false;
|
||||||
@ -616,7 +616,7 @@ bool CCoinJoinServer::AddEntry(const CCoinJoinEntry& entry, PoolMessage& nMessag
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool fConsumeCollateral{false};
|
bool fConsumeCollateral{false};
|
||||||
if (!IsValidInOuts(m_chainstate, mempool, vin, entry.vecTxOut, nMessageIDRet, &fConsumeCollateral)) {
|
if (!IsValidInOuts(m_chainman.ActiveChainstate(), mempool, vin, entry.vecTxOut, nMessageIDRet, &fConsumeCollateral)) {
|
||||||
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- ERROR! IsValidInOuts() failed: %s\n", __func__, CoinJoin::GetMessageByID(nMessageIDRet).translated);
|
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- ERROR! IsValidInOuts() failed: %s\n", __func__, CoinJoin::GetMessageByID(nMessageIDRet).translated);
|
||||||
if (fConsumeCollateral) {
|
if (fConsumeCollateral) {
|
||||||
ConsumeCollateral(entry.txCollateral);
|
ConsumeCollateral(entry.txCollateral);
|
||||||
@ -693,7 +693,7 @@ bool CCoinJoinServer::IsAcceptableDSA(const CCoinJoinAccept& dsa, PoolMessage& n
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check collateral
|
// check collateral
|
||||||
if (!fUnitTest && !CoinJoin::IsCollateralValid(m_chainstate, mempool, CTransaction(dsa.txCollateral))) {
|
if (!fUnitTest && !CoinJoin::IsCollateralValid(m_chainman, mempool, CTransaction(dsa.txCollateral))) {
|
||||||
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- collateral not valid!\n", __func__);
|
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- collateral not valid!\n", __func__);
|
||||||
nMessageIDRet = ERR_INVALID_COLLATERAL;
|
nMessageIDRet = ERR_INVALID_COLLATERAL;
|
||||||
return false;
|
return false;
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
#include <protocol.h>
|
#include <protocol.h>
|
||||||
|
|
||||||
class CActiveMasternodeManager;
|
class CActiveMasternodeManager;
|
||||||
class CChainState;
|
|
||||||
class CCoinJoinServer;
|
class CCoinJoinServer;
|
||||||
class CDataStream;
|
class CDataStream;
|
||||||
class CDeterministicMNManager;
|
class CDeterministicMNManager;
|
||||||
class CDSTXManager;
|
class CDSTXManager;
|
||||||
|
class ChainstateManager;
|
||||||
class CMasternodeMetaMan;
|
class CMasternodeMetaMan;
|
||||||
class CNode;
|
class CNode;
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
@ -27,7 +27,7 @@ class UniValue;
|
|||||||
class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
|
class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CChainState& m_chainstate;
|
ChainstateManager& m_chainman;
|
||||||
CConnman& connman;
|
CConnman& connman;
|
||||||
CDeterministicMNManager& m_dmnman;
|
CDeterministicMNManager& m_dmnman;
|
||||||
CDSTXManager& m_dstxman;
|
CDSTXManager& m_dstxman;
|
||||||
@ -90,11 +90,11 @@ private:
|
|||||||
void SetNull() override EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin);
|
void SetNull() override EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CCoinJoinServer(CChainState& chainstate, CConnman& _connman, CDeterministicMNManager& dmnman,
|
explicit CCoinJoinServer(ChainstateManager& chainman, CConnman& _connman, CDeterministicMNManager& dmnman,
|
||||||
CDSTXManager& dstxman, CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool,
|
CDSTXManager& dstxman, CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool,
|
||||||
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
|
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
|
||||||
std::unique_ptr<PeerManager>& peerman) :
|
std::unique_ptr<PeerManager>& peerman) :
|
||||||
m_chainstate(chainstate),
|
m_chainman(chainman),
|
||||||
connman(_connman),
|
connman(_connman),
|
||||||
m_dmnman(dmnman),
|
m_dmnman(dmnman),
|
||||||
m_dstxman(dstxman),
|
m_dstxman(dstxman),
|
||||||
|
@ -1891,7 +1891,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
node.llmq_ctx->Stop();
|
node.llmq_ctx->Stop();
|
||||||
}
|
}
|
||||||
node.llmq_ctx.reset();
|
node.llmq_ctx.reset();
|
||||||
node.llmq_ctx = std::make_unique<LLMQContext>(chainman.ActiveChainstate(), *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman,
|
node.llmq_ctx = std::make_unique<LLMQContext>(chainman, *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman,
|
||||||
*node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState);
|
*node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState);
|
||||||
// Enable CMNHFManager::{Process, Undo}Block
|
// Enable CMNHFManager::{Process, Undo}Block
|
||||||
node.mnhf_manager->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
|
node.mnhf_manager->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
|
||||||
@ -2153,7 +2153,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
|
|
||||||
// ********************************************************* Step 7c: Setup CoinJoin
|
// ********************************************************* Step 7c: Setup CoinJoin
|
||||||
|
|
||||||
node.cj_ctx = std::make_unique<CJContext>(chainman.ActiveChainstate(), *node.connman, *node.dmnman, *node.mn_metaman, *node.mempool,
|
node.cj_ctx = std::make_unique<CJContext>(chainman, *node.connman, *node.dmnman, *node.mn_metaman, *node.mempool,
|
||||||
node.mn_activeman.get(), *node.mn_sync, node.peerman, !ignores_incoming_txs);
|
node.mn_activeman.get(), *node.mn_sync, node.peerman, !ignores_incoming_txs);
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <llmq/context.h>
|
#include <llmq/context.h>
|
||||||
|
|
||||||
#include <dbwrapper.h>
|
#include <dbwrapper.h>
|
||||||
|
#include <validation.h>
|
||||||
|
|
||||||
#include <llmq/blockprocessor.h>
|
#include <llmq/blockprocessor.h>
|
||||||
#include <llmq/chainlocks.h>
|
#include <llmq/chainlocks.h>
|
||||||
@ -17,7 +18,7 @@
|
|||||||
#include <llmq/signing.h>
|
#include <llmq/signing.h>
|
||||||
#include <llmq/signing_shares.h>
|
#include <llmq/signing_shares.h>
|
||||||
|
|
||||||
LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db,
|
LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db,
|
||||||
CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman,
|
CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman,
|
||||||
CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman,
|
CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman,
|
||||||
const CMasternodeSync& mn_sync, const std::unique_ptr<PeerManager>& peerman, bool unit_tests,
|
const CMasternodeSync& mn_sync, const std::unique_ptr<PeerManager>& peerman, bool unit_tests,
|
||||||
@ -25,28 +26,30 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
|
|||||||
is_masternode{mn_activeman != nullptr},
|
is_masternode{mn_activeman != nullptr},
|
||||||
bls_worker{std::make_shared<CBLSWorker>()},
|
bls_worker{std::make_shared<CBLSWorker>()},
|
||||||
dkg_debugman{std::make_unique<llmq::CDKGDebugManager>()},
|
dkg_debugman{std::make_unique<llmq::CDKGDebugManager>()},
|
||||||
quorum_block_processor{std::make_unique<llmq::CQuorumBlockProcessor>(chainstate, dmnman, evo_db)},
|
quorum_block_processor{std::make_unique<llmq::CQuorumBlockProcessor>(chainman.ActiveChainstate(), dmnman, evo_db)},
|
||||||
qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainstate, connman, dmnman, *dkg_debugman,
|
qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *dkg_debugman,
|
||||||
mn_metaman, *quorum_block_processor, mn_activeman, sporkman,
|
mn_metaman, *quorum_block_processor, mn_activeman, sporkman,
|
||||||
peerman, unit_tests, wipe)},
|
peerman, unit_tests, wipe)},
|
||||||
qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, chainstate, connman, dmnman, *qdkgsman, evo_db,
|
qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, chainman.ActiveChainstate(), connman, dmnman, *qdkgsman, evo_db,
|
||||||
*quorum_block_processor, mn_activeman, mn_sync, sporkman, unit_tests,
|
*quorum_block_processor, mn_activeman, mn_sync, sporkman, unit_tests,
|
||||||
wipe)},
|
wipe)},
|
||||||
sigman{std::make_unique<llmq::CSigningManager>(connman, mn_activeman, chainstate, *qman, peerman, unit_tests, wipe)},
|
sigman{std::make_unique<llmq::CSigningManager>(connman, mn_activeman, chainman.ActiveChainstate(), *qman, peerman, unit_tests, wipe)},
|
||||||
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *sigman, mn_activeman, *qman, sporkman, peerman)},
|
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *sigman, mn_activeman, *qman, sporkman, peerman)},
|
||||||
clhandler{[&]() -> llmq::CChainLocksHandler* const {
|
clhandler{[&]() -> llmq::CChainLocksHandler* const {
|
||||||
assert(llmq::chainLocksHandler == nullptr);
|
assert(llmq::chainLocksHandler == nullptr);
|
||||||
llmq::chainLocksHandler = std::make_unique<llmq::CChainLocksHandler>(chainstate, *qman, *sigman, *shareman,
|
llmq::chainLocksHandler = std::make_unique<llmq::CChainLocksHandler>(chainman.ActiveChainstate(), *qman, *sigman, *shareman,
|
||||||
sporkman, mempool, mn_sync, is_masternode);
|
sporkman, mempool, mn_sync, is_masternode);
|
||||||
return llmq::chainLocksHandler.get();
|
return llmq::chainLocksHandler.get();
|
||||||
}()},
|
}()},
|
||||||
isman{[&]() -> llmq::CInstantSendManager* const {
|
isman{[&]() -> llmq::CInstantSendManager* const {
|
||||||
assert(llmq::quorumInstantSendManager == nullptr);
|
assert(llmq::quorumInstantSendManager == nullptr);
|
||||||
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *qman, *sigman, *shareman, sporkman, mempool, mn_sync, peerman, is_masternode, unit_tests, wipe);
|
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(
|
||||||
|
*llmq::chainLocksHandler, chainman.ActiveChainstate(), connman, *qman, *sigman, *shareman, sporkman,
|
||||||
|
mempool, mn_sync, peerman, is_masternode, unit_tests, wipe);
|
||||||
return llmq::quorumInstantSendManager.get();
|
return llmq::quorumInstantSendManager.get();
|
||||||
}()},
|
}()},
|
||||||
ehfSignalsHandler{
|
ehfSignalsHandler{
|
||||||
std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, *qman)}
|
std::make_unique<llmq::CEHFSignalsHandler>(chainman, mnhfman, *sigman, *shareman, *qman)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
class CActiveMasternodeManager;
|
class CActiveMasternodeManager;
|
||||||
class CBLSWorker;
|
class CBLSWorker;
|
||||||
class CChainState;
|
|
||||||
class CConnman;
|
class CConnman;
|
||||||
|
class ChainstateManager;
|
||||||
class CDeterministicMNManager;
|
class CDeterministicMNManager;
|
||||||
class CDBWrapper;
|
class CDBWrapper;
|
||||||
class CEvoDB;
|
class CEvoDB;
|
||||||
@ -40,7 +40,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
LLMQContext() = delete;
|
LLMQContext() = delete;
|
||||||
LLMQContext(const LLMQContext&) = delete;
|
LLMQContext(const LLMQContext&) = delete;
|
||||||
LLMQContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db,
|
LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterministicMNManager& dmnman, CEvoDB& evo_db,
|
||||||
CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, CTxMemPool& mempool,
|
CMasternodeMetaMan& mn_metaman, CMNHFManager& mnhfman, CSporkManager& sporkman, CTxMemPool& mempool,
|
||||||
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
|
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
|
||||||
const std::unique_ptr<PeerManager>& peerman, bool unit_tests, bool wipe);
|
const std::unique_ptr<PeerManager>& peerman, bool unit_tests, bool wipe);
|
||||||
|
@ -15,19 +15,17 @@
|
|||||||
#include <deploymentstatus.h>
|
#include <deploymentstatus.h>
|
||||||
#include <index/txindex.h> // g_txindex
|
#include <index/txindex.h> // g_txindex
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <txmempool.h>
|
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
namespace llmq {
|
namespace llmq {
|
||||||
|
|
||||||
|
|
||||||
CEHFSignalsHandler::CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
|
CEHFSignalsHandler::CEHFSignalsHandler(ChainstateManager& chainman, CMNHFManager& mnhfman, CSigningManager& sigman,
|
||||||
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman) :
|
CSigSharesManager& shareman, const CQuorumManager& qman) :
|
||||||
chainstate(chainstate),
|
m_chainman(chainman),
|
||||||
mnhfman(mnhfman),
|
mnhfman(mnhfman),
|
||||||
sigman(sigman),
|
sigman(sigman),
|
||||||
shareman(shareman),
|
shareman(shareman),
|
||||||
mempool(mempool),
|
|
||||||
qman(qman)
|
qman(qman)
|
||||||
{
|
{
|
||||||
sigman.RegisterRecoveredSigsListener(this);
|
sigman.RegisterRecoveredSigsListener(this);
|
||||||
@ -77,7 +75,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto quorum = llmq::SelectQuorumForSigning(llmq_params_opt.value(), chainstate.m_chain, qman, requestId);
|
const auto quorum = llmq::SelectQuorumForSigning(llmq_params_opt.value(), m_chainman.ActiveChain(), qman, requestId);
|
||||||
if (!quorum) {
|
if (!quorum) {
|
||||||
LogPrintf("CEHFSignalsHandler::trySignEHFSignal no quorum for id=%s\n", requestId.ToString());
|
LogPrintf("CEHFSignalsHandler::trySignEHFSignal no quorum for id=%s\n", requestId.ToString());
|
||||||
return;
|
return;
|
||||||
@ -103,7 +101,7 @@ MessageProcessingResult CEHFSignalsHandler::HandleNewRecoveredSig(const CRecover
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageProcessingResult ret;
|
MessageProcessingResult ret;
|
||||||
const auto ehfSignals = mnhfman.GetSignalsStage(WITH_LOCK(cs_main, return chainstate.m_chain.Tip()));
|
const auto ehfSignals = mnhfman.GetSignalsStage(WITH_LOCK(cs_main, return m_chainman.ActiveTip()));
|
||||||
MNHFTxPayload mnhfPayload;
|
MNHFTxPayload mnhfPayload;
|
||||||
for (const auto& deployment : Params().GetConsensus().vDeployments) {
|
for (const auto& deployment : Params().GetConsensus().vDeployments) {
|
||||||
// skip deployments that do not use dip0023 or that have already been mined
|
// skip deployments that do not use dip0023 or that have already been mined
|
||||||
@ -126,7 +124,7 @@ MessageProcessingResult CEHFSignalsHandler::HandleNewRecoveredSig(const CRecover
|
|||||||
CTransactionRef tx_to_sent = MakeTransactionRef(std::move(tx));
|
CTransactionRef tx_to_sent = MakeTransactionRef(std::move(tx));
|
||||||
LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig Special EHF TX is created hash=%s\n", tx_to_sent->GetHash().ToString());
|
LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig Special EHF TX is created hash=%s\n", tx_to_sent->GetHash().ToString());
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
const MempoolAcceptResult result = AcceptToMemoryPool(chainstate, mempool, tx_to_sent, /* bypass_limits */ false);
|
const MempoolAcceptResult result = m_chainman.ProcessTransaction(tx_to_sent);
|
||||||
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
||||||
ret.m_transactions.push_back(tx_to_sent->GetHash());
|
ret.m_transactions.push_back(tx_to_sent->GetHash());
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,9 +10,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
class CChainState;
|
class ChainstateManager;
|
||||||
class CMNHFManager;
|
class CMNHFManager;
|
||||||
class CTxMemPool;
|
|
||||||
|
|
||||||
namespace llmq
|
namespace llmq
|
||||||
{
|
{
|
||||||
@ -23,11 +22,10 @@ class CSigningManager;
|
|||||||
class CEHFSignalsHandler : public CRecoveredSigsListener
|
class CEHFSignalsHandler : public CRecoveredSigsListener
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CChainState& chainstate;
|
ChainstateManager& m_chainman;
|
||||||
CMNHFManager& mnhfman;
|
CMNHFManager& mnhfman;
|
||||||
CSigningManager& sigman;
|
CSigningManager& sigman;
|
||||||
CSigSharesManager& shareman;
|
CSigSharesManager& shareman;
|
||||||
CTxMemPool& mempool;
|
|
||||||
const CQuorumManager& qman;
|
const CQuorumManager& qman;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,8 +34,8 @@ private:
|
|||||||
mutable Mutex cs;
|
mutable Mutex cs;
|
||||||
std::set<uint256> ids GUARDED_BY(cs);
|
std::set<uint256> ids GUARDED_BY(cs);
|
||||||
public:
|
public:
|
||||||
explicit CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
|
explicit CEHFSignalsHandler(ChainstateManager& chainman, CMNHFManager& mnhfman, CSigningManager& sigman,
|
||||||
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman);
|
CSigSharesManager& shareman, const CQuorumManager& qman);
|
||||||
|
|
||||||
~CEHFSignalsHandler();
|
~CEHFSignalsHandler();
|
||||||
|
|
||||||
|
@ -134,10 +134,10 @@ static RPCHelpMan coinjoin_start()
|
|||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing has been started already.");
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing has been started already.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChainstateManager& chainman = EnsureChainman(node);
|
ChainstateManager& chainman = EnsureChainman(node);
|
||||||
CTxMemPool& mempool = EnsureMemPool(node);
|
CTxMemPool& mempool = EnsureMemPool(node);
|
||||||
CConnman& connman = EnsureConnman(node);
|
CConnman& connman = EnsureConnman(node);
|
||||||
bool result = cj_clientman->DoAutomaticDenominating(chainman.ActiveChainstate(), connman, mempool);
|
bool result = cj_clientman->DoAutomaticDenominating(chainman, connman, mempool);
|
||||||
return "Mixing " + (result ? "started successfully" : ("start failed: " + cj_clientman->GetStatuses().original + ", will retry"));
|
return "Mixing " + (result ? "started successfully" : ("start failed: " + cj_clientman->GetStatuses().original + ", will retry"));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -110,12 +110,12 @@ void DashTestSetup(NodeContext& node, const CChainParams& chainparams)
|
|||||||
node.dmnman = std::make_unique<CDeterministicMNManager>(chainstate, *node.connman, *node.evodb);
|
node.dmnman = std::make_unique<CDeterministicMNManager>(chainstate, *node.connman, *node.evodb);
|
||||||
node.mempool->ConnectManagers(node.dmnman.get());
|
node.mempool->ConnectManagers(node.dmnman.get());
|
||||||
|
|
||||||
node.cj_ctx = std::make_unique<CJContext>(chainstate, *node.connman, *node.dmnman, *node.mn_metaman, *node.mempool,
|
node.cj_ctx = std::make_unique<CJContext>(*node.chainman, *node.connman, *node.dmnman, *node.mn_metaman, *node.mempool,
|
||||||
/* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* relay_txes = */ true);
|
/* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* relay_txes = */ true);
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
node.coinjoin_loader = interfaces::MakeCoinJoinLoader(*node.cj_ctx->walletman);
|
node.coinjoin_loader = interfaces::MakeCoinJoinLoader(*node.cj_ctx->walletman);
|
||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
node.llmq_ctx = std::make_unique<LLMQContext>(chainstate, *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, *node.mempool,
|
node.llmq_ctx = std::make_unique<LLMQContext>(*node.chainman, *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, *node.mempool,
|
||||||
/* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* unit_tests = */ true, /* wipe = */ false);
|
/* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* unit_tests = */ true, /* wipe = */ false);
|
||||||
Assert(node.mnhf_manager)->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
|
Assert(node.mnhf_manager)->ConnectManagers(node.chainman.get(), node.llmq_ctx->qman.get());
|
||||||
node.chain_helper = std::make_unique<CChainstateHelper>(*node.cpoolman, *node.dmnman, *node.mnhf_manager, *node.govman, *(node.llmq_ctx->quorum_block_processor), *node.chainman,
|
node.chain_helper = std::make_unique<CChainstateHelper>(*node.cpoolman, *node.dmnman, *node.mnhf_manager, *node.govman, *(node.llmq_ctx->quorum_block_processor), *node.chainman,
|
||||||
|
Loading…
Reference in New Issue
Block a user