Skip to content

Commit e9ec822

Browse files
committed
refactor: drop dependency of InstantSend on CMasternodeSync
1 parent f958112 commit e9ec822

5 files changed

Lines changed: 9 additions & 21 deletions

File tree

src/instantsend/instantsend.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <chainparams.h>
88
#include <consensus/validation.h>
9-
#include <masternode/sync.h>
109
#include <node/blockstorage.h>
1110
#include <spork.h>
1211
#include <stats/client.h>
@@ -15,11 +14,9 @@ using node::fImporting;
1514
using node::fReindex;
1615

1716
namespace llmq {
18-
CInstantSendManager::CInstantSendManager(CSporkManager& sporkman, const CMasternodeSync& mn_sync,
19-
const util::DbWrapperParams& db_params) :
17+
CInstantSendManager::CInstantSendManager(CSporkManager& sporkman, const util::DbWrapperParams& db_params) :
2018
db{db_params},
21-
spork_manager{sporkman},
22-
m_mn_sync{mn_sync}
19+
spork_manager{sporkman}
2320
{
2421
}
2522

@@ -471,9 +468,6 @@ bool CInstantSendManager::IsInstantSendEnabled() const
471468

472469
bool CInstantSendManager::RejectConflictingBlocks() const
473470
{
474-
if (!m_mn_sync.IsBlockchainSynced()) {
475-
return false;
476-
}
477471
if (!spork_manager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) {
478472
LogPrint(BCLog::INSTANTSEND, "%s: spork3 is off, skipping transaction locking checks\n", __func__);
479473
return false;

src/instantsend/instantsend.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
class CBlockIndex;
2222
class CDataStream;
23-
class CMasternodeSync;
2423
class CSporkManager;
2524
namespace Consensus {
2625
struct LLMQParams;
@@ -54,7 +53,6 @@ class CInstantSendManager
5453
private:
5554
instantsend::CInstantSendDb db;
5655
CSporkManager& spork_manager;
57-
const CMasternodeSync& m_mn_sync;
5856

5957
mutable Mutex cs_pendingLocks;
6058
// Incoming and not verified yet
@@ -90,8 +88,7 @@ class CInstantSendManager
9088
CInstantSendManager() = delete;
9189
CInstantSendManager(const CInstantSendManager&) = delete;
9290
CInstantSendManager& operator=(const CInstantSendManager&) = delete;
93-
explicit CInstantSendManager(CSporkManager& sporkman, const CMasternodeSync& mn_sync,
94-
const util::DbWrapperParams& db_params);
91+
explicit CInstantSendManager(CSporkManager& sporkman, const util::DbWrapperParams& db_params);
9592
~CInstantSendManager();
9693

9794
void AddNonLockedTx(const CTransactionRef& tx, const CBlockIndex* pindexMined)

src/llmq/context.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@
1313
#include <validation.h>
1414

1515
LLMQContext::LLMQContext(CDeterministicMNManager& dmnman, CEvoDB& evo_db, CSporkManager& sporkman,
16-
ChainstateManager& chainman, const CMasternodeSync& mn_sync,
17-
const util::DbWrapperParams& db_params, int8_t bls_threads, int16_t worker_count,
18-
int64_t max_recsigs_age) :
16+
ChainstateManager& chainman, const util::DbWrapperParams& db_params, int8_t bls_threads,
17+
int16_t worker_count, int64_t max_recsigs_age) :
1918
bls_worker{std::make_shared<CBLSWorker>()},
2019
qsnapman{std::make_unique<llmq::CQuorumSnapshotManager>(evo_db)},
2120
quorum_block_processor{std::make_unique<llmq::CQuorumBlockProcessor>(chainman.ActiveChainstate(), dmnman, evo_db,
2221
*qsnapman, bls_threads)},
2322
qman{std::make_unique<llmq::CQuorumManager>(*bls_worker, dmnman, evo_db, *quorum_block_processor, *qsnapman,
2423
chainman, db_params)},
2524
sigman{std::make_unique<llmq::CSigningManager>(*qman, db_params, max_recsigs_age)},
26-
isman{std::make_unique<llmq::CInstantSendManager>(sporkman, mn_sync, db_params)}
25+
isman{std::make_unique<llmq::CInstantSendManager>(sporkman, db_params)}
2726
{
2827
// Have to start it early to let VerifyDB check ChainLock signatures in coinbase
2928
bls_worker->Start(worker_count);

src/llmq/context.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class CBLSWorker;
1313
class ChainstateManager;
1414
class CDeterministicMNManager;
1515
class CEvoDB;
16-
class CMasternodeSync;
1716
class CSporkManager;
1817
class PeerManager;
1918

@@ -34,9 +33,8 @@ struct LLMQContext {
3433
LLMQContext(const LLMQContext&) = delete;
3534
LLMQContext& operator=(const LLMQContext&) = delete;
3635
explicit LLMQContext(CDeterministicMNManager& dmnman, CEvoDB& evo_db, CSporkManager& sporkman,
37-
ChainstateManager& chainman, const CMasternodeSync& mn_sync,
38-
const util::DbWrapperParams& db_params, int8_t bls_threads, int16_t worker_count,
39-
int64_t max_recsigs_age);
36+
ChainstateManager& chainman, const util::DbWrapperParams& db_params, int8_t bls_threads,
37+
int16_t worker_count, int64_t max_recsigs_age);
4038
~LLMQContext();
4139

4240
/** Guaranteed if LLMQContext is initialized then all members are valid too

src/node/chainstate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void DashChainstateSetup(ChainstateManager& chainman,
230230
dmnman = std::make_unique<CDeterministicMNManager>(evodb, mn_metaman);
231231

232232
llmq_ctx.reset();
233-
llmq_ctx = std::make_unique<LLMQContext>(*dmnman, evodb, sporkman, chainman, mn_sync,
233+
llmq_ctx = std::make_unique<LLMQContext>(*dmnman, evodb, sporkman, chainman,
234234
util::DbWrapperParams{.path = data_dir, .memory = llmq_dbs_in_memory, .wipe = llmq_dbs_wipe},
235235
bls_threads, worker_count, max_recsigs_age);
236236
mempool->ConnectManagers(dmnman.get(), llmq_ctx->isman.get());

0 commit comments

Comments
 (0)