mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
instantsend: misc refactorings (#4017)
* instantsend: remove unused variable sum of input value Signed-off-by: pasta <pasta@dashboost.org> * instantsend: Access static member statically Signed-off-by: pasta <pasta@dashboost.org> * refac: make functions private as possible
This commit is contained in:
parent
85296954d3
commit
639f42abb7
@ -549,8 +549,7 @@ bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug,
|
||||
}
|
||||
|
||||
for (const auto& in : tx.vin) {
|
||||
CAmount v = 0;
|
||||
if (!CheckCanLock(in.prevout, printDebug, tx.GetHash(), &v, params)) {
|
||||
if (!CheckCanLock(in.prevout, printDebug, tx.GetHash(), params)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -558,7 +557,7 @@ bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) const
|
||||
bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, const Consensus::Params& params) const
|
||||
{
|
||||
int nInstantSendConfirmationsRequired = params.nInstantSendConfirmationsRequired;
|
||||
|
||||
@ -605,10 +604,6 @@ bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebu
|
||||
}
|
||||
}
|
||||
|
||||
if (retValue) {
|
||||
*retValue = tx->vout[outpoint.n].nValue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -873,7 +868,7 @@ std::unordered_set<uint256> CInstantSendManager::ProcessPendingInstantSendLocks(
|
||||
continue;
|
||||
}
|
||||
|
||||
auto quorum = quorumSigningManager->SelectQuorumForSigning(llmqType, id, -1, signOffset);
|
||||
auto quorum = llmq::CSigningManager::SelectQuorumForSigning(llmqType, id, -1, signOffset);
|
||||
if (!quorum) {
|
||||
// should not happen, but if one fails to select, all others will also fail to select
|
||||
return {};
|
||||
|
@ -125,57 +125,62 @@ public:
|
||||
void Stop();
|
||||
void InterruptWorkerThread();
|
||||
|
||||
public:
|
||||
private:
|
||||
void ProcessTx(const CTransaction& tx, bool fRetroactive, const Consensus::Params& params);
|
||||
bool CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) const;
|
||||
bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) const;
|
||||
bool IsLocked(const uint256& txHash) const;
|
||||
bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, const Consensus::Params& params) const;
|
||||
bool IsConflicted(const CTransaction& tx) const;
|
||||
CInstantSendLockPtr GetConflictingLock(const CTransaction& tx) const;
|
||||
|
||||
virtual void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig);
|
||||
void HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid);
|
||||
void HandleNewInstantSendLockRecoveredSig(const CRecoveredSig& recoveredSig);
|
||||
|
||||
bool TrySignInputLocks(const CTransaction& tx, bool allowResigning, Consensus::LLMQType llmqType);
|
||||
void TrySignInstantSendLock(const CTransaction& tx);
|
||||
|
||||
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv);
|
||||
void ProcessMessageInstantSendLock(CNode* pfrom, const CInstantSendLockPtr& islock);
|
||||
static bool PreVerifyInstantSendLock(const CInstantSendLock& islock);
|
||||
bool ProcessPendingInstantSendLocks();
|
||||
std::unordered_set<uint256> ProcessPendingInstantSendLocks(int signOffset, const std::unordered_map<uint256, std::pair<NodeId, CInstantSendLockPtr>, StaticSaltedHasher>& pend, bool ban);
|
||||
void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLockPtr& islock);
|
||||
|
||||
void TransactionAddedToMempool(const CTransactionRef& tx);
|
||||
void TransactionRemovedFromMempool(const CTransactionRef& tx);
|
||||
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted);
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected);
|
||||
|
||||
void AddNonLockedTx(const CTransactionRef& tx, const CBlockIndex* pindexMined);
|
||||
void RemoveNonLockedTx(const uint256& txid, bool retryChildren);
|
||||
void RemoveConflictedTx(const CTransaction& tx);
|
||||
void TruncateRecoveredSigsForInputs(const CInstantSendLock& islock);
|
||||
|
||||
void NotifyChainLock(const CBlockIndex* pindexChainLock);
|
||||
void UpdatedBlockTip(const CBlockIndex* pindexNew);
|
||||
void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock);
|
||||
void ResolveBlockConflicts(const uint256& islockHash, const CInstantSendLock& islock);
|
||||
static void AskNodesForLockedTx(const uint256& txid);
|
||||
void ProcessPendingRetryLockTxs();
|
||||
|
||||
void WorkThreadMain();
|
||||
|
||||
void HandleFullyConfirmedBlock(const CBlockIndex* pindex);
|
||||
|
||||
void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock);
|
||||
void ResolveBlockConflicts(const uint256& islockHash, const CInstantSendLock& islock);
|
||||
void RemoveConflictingLock(const uint256& islockHash, const CInstantSendLock& islock);
|
||||
static void AskNodesForLockedTx(const uint256& txid);
|
||||
void ProcessPendingRetryLockTxs();
|
||||
public:
|
||||
bool IsLocked(const uint256& txHash) const;
|
||||
CInstantSendLockPtr GetConflictingLock(const CTransaction& tx) const;
|
||||
|
||||
virtual void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig);
|
||||
|
||||
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv);
|
||||
|
||||
void TransactionAddedToMempool(const CTransactionRef& tx);
|
||||
void TransactionRemovedFromMempool(const CTransactionRef& tx);
|
||||
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted);
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected);
|
||||
|
||||
bool AlreadyHave(const CInv& inv) const;
|
||||
bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret) const;
|
||||
CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const;
|
||||
bool GetInstantSendLockHashByTxid(const uint256& txid, uint256& ret) const;
|
||||
|
||||
size_t GetInstantSendLockCount() const;
|
||||
void NotifyChainLock(const CBlockIndex* pindexChainLock);
|
||||
void UpdatedBlockTip(const CBlockIndex* pindexNew);
|
||||
|
||||
void WorkThreadMain();
|
||||
void RemoveConflictingLock(const uint256& islockHash, const CInstantSendLock& islock);
|
||||
|
||||
size_t GetInstantSendLockCount() const;
|
||||
};
|
||||
|
||||
extern CInstantSendManager* quorumInstantSendManager;
|
||||
|
Loading…
Reference in New Issue
Block a user