mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Call new signals instead of SyncTransaction on CInstantSendManager
This commit moves all logic of SyncTransaction into ProcessNewTransaction and then calls it from TransactionAddedToMempool and BlockConnected. This won't compile/work at first, but the next commits will fix this.
This commit is contained in:
parent
6afa605f6f
commit
b36f0a324f
@ -74,7 +74,6 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
|
|||||||
|
|
||||||
void CDSNotificationInterface::SyncTransaction(const CTransactionRef& tx, const CBlockIndex* pindex, int posInBlock)
|
void CDSNotificationInterface::SyncTransaction(const CTransactionRef& tx, const CBlockIndex* pindex, int posInBlock)
|
||||||
{
|
{
|
||||||
llmq::quorumInstantSendManager->SyncTransaction(tx, pindex, posInBlock);
|
|
||||||
llmq::chainLocksHandler->SyncTransaction(tx, pindex, posInBlock);
|
llmq::chainLocksHandler->SyncTransaction(tx, pindex, posInBlock);
|
||||||
instantsend.SyncTransaction(tx, pindex, posInBlock);
|
instantsend.SyncTransaction(tx, pindex, posInBlock);
|
||||||
CPrivateSend::SyncTransaction(tx, pindex, posInBlock);
|
CPrivateSend::SyncTransaction(tx, pindex, posInBlock);
|
||||||
@ -82,6 +81,7 @@ void CDSNotificationInterface::SyncTransaction(const CTransactionRef& tx, const
|
|||||||
|
|
||||||
void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef& ptx)
|
void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef& ptx)
|
||||||
{
|
{
|
||||||
|
llmq::quorumInstantSendManager->TransactionAddedToMempool(ptx);
|
||||||
SyncTransaction(ptx);
|
SyncTransaction(ptx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +95,8 @@ void CDSNotificationInterface::BlockConnected(const std::shared_ptr<const CBlock
|
|||||||
// to abandon a transaction and then have it inadvertantly cleared by
|
// to abandon a transaction and then have it inadvertantly cleared by
|
||||||
// the notification that the conflicted transaction was evicted.
|
// the notification that the conflicted transaction was evicted.
|
||||||
|
|
||||||
|
llmq::quorumInstantSendManager->BlockConnected(pblock, pindex, vtxConflicted);
|
||||||
|
|
||||||
for (const CTransactionRef& ptx : vtxConflicted) {
|
for (const CTransactionRef& ptx : vtxConflicted) {
|
||||||
SyncTransaction(ptx);
|
SyncTransaction(ptx);
|
||||||
}
|
}
|
||||||
@ -105,6 +107,8 @@ void CDSNotificationInterface::BlockConnected(const std::shared_ptr<const CBlock
|
|||||||
|
|
||||||
void CDSNotificationInterface::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected)
|
void CDSNotificationInterface::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected)
|
||||||
{
|
{
|
||||||
|
llmq::quorumInstantSendManager->BlockDisconnected(pblock, pindexDisconnected);
|
||||||
|
|
||||||
for (const CTransactionRef& ptx : pblock->vtx) {
|
for (const CTransactionRef& ptx : pblock->vtx) {
|
||||||
SyncTransaction(ptx, pindexDisconnected->pprev, -1);
|
SyncTransaction(ptx, pindexDisconnected->pprev, -1);
|
||||||
}
|
}
|
||||||
|
@ -949,7 +949,7 @@ void CInstantSendManager::UpdateWalletTransaction(const CTransactionRef& tx, con
|
|||||||
mempool.AddTransactionsUpdated(1);
|
mempool.AddTransactionsUpdated(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInstantSendManager::SyncTransaction(const CTransactionRef& tx, const CBlockIndex* pindex, int posInBlock)
|
void CInstantSendManager::ProcessNewTransaction(const CTransactionRef& tx, const CBlockIndex* pindex)
|
||||||
{
|
{
|
||||||
if (!IsNewInstantSendEnabled()) {
|
if (!IsNewInstantSendEnabled()) {
|
||||||
return;
|
return;
|
||||||
@ -1008,6 +1008,26 @@ void CInstantSendManager::SyncTransaction(const CTransactionRef& tx, const CBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInstantSendManager::TransactionAddedToMempool(const CTransactionRef& tx)
|
||||||
|
{
|
||||||
|
ProcessNewTransaction(tx, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInstantSendManager::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted)
|
||||||
|
{
|
||||||
|
if (!IsNewInstantSendEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& tx : pblock->vtx) {
|
||||||
|
ProcessNewTransaction(tx, pindex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInstantSendManager::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void CInstantSendManager::AddNonLockedTx(const CTransactionRef& tx)
|
void CInstantSendManager::AddNonLockedTx(const CTransactionRef& tx)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs);
|
AssertLockHeld(cs);
|
||||||
|
@ -141,7 +141,10 @@ public:
|
|||||||
void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLock& islock);
|
void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLock& islock);
|
||||||
void UpdateWalletTransaction(const CTransactionRef& tx, const CInstantSendLock& islock);
|
void UpdateWalletTransaction(const CTransactionRef& tx, const CInstantSendLock& islock);
|
||||||
|
|
||||||
void SyncTransaction(const CTransactionRef& tx, const CBlockIndex* pindex = nullptr, int posInBlock = 0);
|
void ProcessNewTransaction(const CTransactionRef& tx, const CBlockIndex* pindex);
|
||||||
|
void TransactionAddedToMempool(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);
|
void AddNonLockedTx(const CTransactionRef& tx);
|
||||||
void RemoveNonLockedTx(const uint256& txid, bool retryChildren);
|
void RemoveNonLockedTx(const uint256& txid, bool retryChildren);
|
||||||
void RemoveConflictedTx(const CTransaction& tx);
|
void RemoveConflictedTx(const CTransaction& tx);
|
||||||
|
Loading…
Reference in New Issue
Block a user