dash/src/dsnotificationinterface.h
UdjinM6 cd7cd85fe7
instantsend: Use NotifyEntryRemoved signal instead of calling CInstantSendManager::TransactionRemovedFromMempool from CTxMemPool::removeUnchecked directly (#4160)
* instantsend: Use `NotifyEntryRemoved` signal instead of calling `CInstantSendManager::TransactionRemovedFromMempool` from `CTxMemPool::removeUnchecked` directly

Fixes potential mempool.cs vs cs_main (in RemoveConflictingLock) deadlock

* Apply suggestions from code review

yay, typso!

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-05-19 01:02:31 +02:00

37 lines
1.8 KiB
C++

// Copyright (c) 2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_DSNOTIFICATIONINTERFACE_H
#define BITCOIN_DSNOTIFICATIONINTERFACE_H
#include <validationinterface.h>
class CDSNotificationInterface : public CValidationInterface
{
public:
explicit CDSNotificationInterface(CConnman& connmanIn): connman(connmanIn) {}
virtual ~CDSNotificationInterface() = default;
// a small helper to initialize current block height in sub-modules on startup
void InitializeCurrentBlockTip();
protected:
// CValidationInterface
void AcceptedBlockHeader(const CBlockIndex *pindexNew) override;
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) override;
void SynchronousUpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
void TransactionAddedToMempool(const CTransactionRef& tx, int64_t nAcceptTime) override;
void TransactionRemovedFromMempool(const CTransactionRef& ptx, MemPoolRemovalReason reason) override;
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted) override;
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected) override;
void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff) override;
void NotifyChainLock(const CBlockIndex* pindex, const std::shared_ptr<const llmq::CChainLockSig>& clsig) override;
private:
CConnman& connman;
};
#endif // BITCOIN_DSNOTIFICATIONINTERFACE_H