Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | namespace { | ||||
} | } | ||||
class NotificationsProxy : public CValidationInterface { | class NotificationsProxy : public CValidationInterface { | ||||
public: | public: | ||||
explicit NotificationsProxy( | explicit NotificationsProxy( | ||||
std::shared_ptr<Chain::Notifications> notifications) | std::shared_ptr<Chain::Notifications> notifications) | ||||
: m_notifications(std::move(notifications)) {} | : m_notifications(std::move(notifications)) {} | ||||
virtual ~NotificationsProxy() = default; | virtual ~NotificationsProxy() = default; | ||||
void TransactionAddedToMempool(const CTransactionRef &tx) override { | void TransactionAddedToMempool(const CTransactionRef &tx, | ||||
m_notifications->transactionAddedToMempool(tx); | uint64_t mempool_sequence) override { | ||||
} | m_notifications->transactionAddedToMempool(tx, mempool_sequence); | ||||
void | } | ||||
TransactionRemovedFromMempool(const CTransactionRef &tx, | void TransactionRemovedFromMempool(const CTransactionRef &tx, | ||||
MemPoolRemovalReason reason) override { | MemPoolRemovalReason reason, | ||||
m_notifications->transactionRemovedFromMempool(tx, reason); | uint64_t mempool_sequence) override { | ||||
m_notifications->transactionRemovedFromMempool(tx, reason, | |||||
mempool_sequence); | |||||
} | } | ||||
void BlockConnected(const std::shared_ptr<const CBlock> &block, | void BlockConnected(const std::shared_ptr<const CBlock> &block, | ||||
const CBlockIndex *index) override { | const CBlockIndex *index) override { | ||||
m_notifications->blockConnected(*block, index->nHeight); | m_notifications->blockConnected(*block, index->nHeight); | ||||
} | } | ||||
void BlockDisconnected(const std::shared_ptr<const CBlock> &block, | void BlockDisconnected(const std::shared_ptr<const CBlock> &block, | ||||
const CBlockIndex *index) override { | const CBlockIndex *index) override { | ||||
m_notifications->blockDisconnected(*block, index->nHeight); | m_notifications->blockDisconnected(*block, index->nHeight); | ||||
▲ Show 20 Lines • Show All 380 Lines • ▼ Show 20 Lines | public: | ||||
return gArgs.WriteSettingsFile(); | return gArgs.WriteSettingsFile(); | ||||
} | } | ||||
void requestMempoolTransactions(Notifications ¬ifications) override { | void requestMempoolTransactions(Notifications ¬ifications) override { | ||||
if (!m_node.mempool) { | if (!m_node.mempool) { | ||||
return; | return; | ||||
} | } | ||||
LOCK2(::cs_main, m_node.mempool->cs); | LOCK2(::cs_main, m_node.mempool->cs); | ||||
for (const CTxMemPoolEntry &entry : m_node.mempool->mapTx) { | for (const CTxMemPoolEntry &entry : m_node.mempool->mapTx) { | ||||
notifications.transactionAddedToMempool(entry.GetSharedTx()); | notifications.transactionAddedToMempool( | ||||
entry.GetSharedTx(), 0 /* mempool_sequence */); | |||||
} | } | ||||
} | } | ||||
const CChainParams ¶ms() const override { return m_params; } | const CChainParams ¶ms() const override { return m_params; } | ||||
NodeContext &m_node; | NodeContext &m_node; | ||||
const CChainParams &m_params; | const CChainParams &m_params; | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
std::unique_ptr<Chain> MakeChain(NodeContext &node, | std::unique_ptr<Chain> MakeChain(NodeContext &node, | ||||
const CChainParams ¶ms) { | const CChainParams ¶ms) { | ||||
return std::make_unique<ChainImpl>(node, params); | return std::make_unique<ChainImpl>(node, params); | ||||
} | } | ||||
} // namespace interfaces | } // namespace interfaces |