trivial: add Asserts for m_peerman pointer container uses

This commit is contained in:
Kittywhiskers Van Gogh 2024-04-09 19:42:55 +00:00
parent 35be4e2ebe
commit f2fe39fadc
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
6 changed files with 10 additions and 10 deletions

View File

@ -349,7 +349,7 @@ void CCoinJoinServer::CommitFinalTransaction()
LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- TRANSMITTING DSTX\n"); LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- TRANSMITTING DSTX\n");
CInv inv(MSG_DSTX, hashTx); CInv inv(MSG_DSTX, hashTx);
m_peerman->RelayInv(inv); Assert(m_peerman)->RelayInv(inv);
// Tell the clients it was successful // Tell the clients it was successful
RelayCompletedTransaction(MSG_SUCCESS); RelayCompletedTransaction(MSG_SUCCESS);
@ -460,7 +460,7 @@ void CCoinJoinServer::ConsumeCollateral(const CTransactionRef& txref) const
if (!ATMPIfSaneFee(m_chainstate, mempool, txref, false /* bypass_limits */)) { if (!ATMPIfSaneFee(m_chainstate, mempool, txref, false /* bypass_limits */)) {
LogPrint(BCLog::COINJOIN, "%s -- AcceptToMemoryPool failed\n", __func__); LogPrint(BCLog::COINJOIN, "%s -- AcceptToMemoryPool failed\n", __func__);
} else { } else {
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__);
} }
} }

View File

@ -668,7 +668,7 @@ void CQuorumBlockProcessor::AddMineableCommitment(const CFinalCommitment& fqc)
// We only relay the new commitment if it's new or better then the old one // We only relay the new commitment if it's new or better then the old one
if (relay) { if (relay) {
CInv inv(MSG_QUORUM_FINAL_COMMITMENT, commitmentHash); CInv inv(MSG_QUORUM_FINAL_COMMITMENT, commitmentHash);
m_peerman->RelayInv(inv); Assert(m_peerman)->RelayInv(inv);
} }
} }

View File

@ -162,7 +162,7 @@ PeerMsgRet CChainLocksHandler::ProcessNewChainLock(const NodeId from, const llmq
// Note: do not hold cs while calling RelayInv // Note: do not hold cs while calling RelayInv
AssertLockNotHeld(cs); AssertLockNotHeld(cs);
m_peerman->RelayInv(clsigInv); Assert(m_peerman)->RelayInv(clsigInv);
if (pindex == nullptr) { if (pindex == nullptr) {
// we don't know the block/header for this CLSIG yet, so bail out for now // we don't know the block/header for this CLSIG yet, so bail out for now

View File

@ -140,7 +140,7 @@ void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig
LOCK(cs_main); LOCK(cs_main);
const MempoolAcceptResult result = AcceptToMemoryPool(chainstate, mempool, tx_to_sent, /* bypass_limits */ false); const MempoolAcceptResult result = AcceptToMemoryPool(chainstate, mempool, tx_to_sent, /* bypass_limits */ false);
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) { if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
m_peerman->RelayTransaction(tx_to_sent->GetHash()); Assert(m_peerman)->RelayTransaction(tx_to_sent->GetHash());
} else { } else {
LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig -- AcceptToMemoryPool failed: %s\n", result.m_state.ToString()); LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig -- AcceptToMemoryPool failed: %s\n", result.m_state.ToString());
} }

View File

@ -951,7 +951,7 @@ std::unordered_set<uint256, StaticSaltedHasher> CInstantSendManager::ProcessPend
for (const auto& nodeId : batchVerifier.badSources) { for (const auto& nodeId : batchVerifier.badSources) {
// Let's not be too harsh, as the peer might simply be unlucky and might have sent us an old lock which // Let's not be too harsh, as the peer might simply be unlucky and might have sent us an old lock which
// does not validate anymore due to changed quorums // does not validate anymore due to changed quorums
m_peerman->Misbehaving(nodeId, 20); Assert(m_peerman)->Misbehaving(nodeId, 20);
} }
} }
for (const auto& p : pend) { for (const auto& p : pend) {
@ -1045,11 +1045,11 @@ void CInstantSendManager::ProcessInstantSendLock(NodeId from, const uint256& has
CInv inv(MSG_ISDLOCK, hash); CInv inv(MSG_ISDLOCK, hash);
if (tx != nullptr) { if (tx != nullptr) {
m_peerman->RelayInvFiltered(inv, *tx, ISDLOCK_PROTO_VERSION); Assert(m_peerman)->RelayInvFiltered(inv, *tx, ISDLOCK_PROTO_VERSION);
} else { } else {
// we don't have the TX yet, so we only filter based on txid. Later when that TX arrives, we will re-announce // we don't have the TX yet, so we only filter based on txid. Later when that TX arrives, we will re-announce
// with the TX taken into account. // with the TX taken into account.
m_peerman->RelayInvFiltered(inv, islock->txid, ISDLOCK_PROTO_VERSION); Assert(m_peerman)->RelayInvFiltered(inv, islock->txid, ISDLOCK_PROTO_VERSION);
} }
ResolveBlockConflicts(hash, *islock); ResolveBlockConflicts(hash, *islock);

View File

@ -1394,7 +1394,7 @@ void CSigSharesManager::RemoveBannedNodeStates()
LOCK(cs); LOCK(cs);
for (auto it = nodeStates.begin(); it != nodeStates.end();) { for (auto it = nodeStates.begin(); it != nodeStates.end();) {
if (m_peerman->IsBanned(it->first)) { if (Assert(m_peerman)->IsBanned(it->first)) {
// re-request sigshares from other nodes // re-request sigshares from other nodes
it->second.requestedSigShares.ForEach([this](const SigShareKey& k, int64_t) { it->second.requestedSigShares.ForEach([this](const SigShareKey& k, int64_t) {
AssertLockHeld(cs); AssertLockHeld(cs);
@ -1414,7 +1414,7 @@ void CSigSharesManager::BanNode(NodeId nodeId)
} }
{ {
m_peerman->Misbehaving(nodeId, 100); Assert(m_peerman)->Misbehaving(nodeId, 100);
} }
LOCK(cs); LOCK(cs);