mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Move updating of txFirstSeenTime into TransactionAddedToMempool and BlockConnected
This removes the need for SyncTransaction
This commit is contained in:
parent
a61127e1ae
commit
715a3e9518
@ -347,7 +347,17 @@ void CChainLocksHandler::TrySignChainTip()
|
||||
|
||||
void CChainLocksHandler::TransactionAddedToMempool(const CTransactionRef& tx)
|
||||
{
|
||||
if (tx->IsCoinBase() || tx->vin.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!masternodeSync.IsBlockchainSynced()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOCK(cs);
|
||||
int64_t curTime = GetAdjustedTime();
|
||||
txFirstSeenTime.emplace(tx->GetHash(), curTime);
|
||||
}
|
||||
|
||||
void CChainLocksHandler::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted)
|
||||
@ -370,12 +380,15 @@ void CChainLocksHandler::BlockConnected(const std::shared_ptr<const CBlock>& pbl
|
||||
}
|
||||
auto& txids = *it->second;
|
||||
|
||||
int64_t curTime = GetAdjustedTime();
|
||||
|
||||
for (const auto& tx : pblock->vtx) {
|
||||
if (tx->IsCoinBase() || tx->vin.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
txids.emplace(tx->GetHash());
|
||||
txFirstSeenTime.emplace(tx->GetHash(), curTime);
|
||||
}
|
||||
|
||||
}
|
||||
@ -386,25 +399,6 @@ void CChainLocksHandler::BlockDisconnected(const std::shared_ptr<const CBlock>&
|
||||
blockTxs.erase(pindexDisconnected->GetBlockHash());
|
||||
}
|
||||
|
||||
void CChainLocksHandler::SyncTransaction(const CTransactionRef& tx, const CBlockIndex* pindex, int posInBlock)
|
||||
{
|
||||
if (!masternodeSync.IsBlockchainSynced()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool handleTx = true;
|
||||
if (tx->IsCoinBase() || tx->vin.empty()) {
|
||||
handleTx = false;
|
||||
}
|
||||
|
||||
LOCK(cs);
|
||||
|
||||
if (handleTx) {
|
||||
int64_t curTime = GetAdjustedTime();
|
||||
txFirstSeenTime.emplace(tx->GetHash(), curTime);
|
||||
}
|
||||
}
|
||||
|
||||
CChainLocksHandler::BlockTxs::mapped_type CChainLocksHandler::GetBlockTxs(const uint256& blockHash)
|
||||
{
|
||||
AssertLockNotHeld(cs);
|
||||
|
@ -93,7 +93,6 @@ public:
|
||||
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 SyncTransaction(const CTransactionRef& tx, const CBlockIndex* pindex = nullptr, int posInBlock = 0);
|
||||
void CheckActiveState();
|
||||
void TrySignChainTip();
|
||||
void EnforceBestChainLock();
|
||||
|
Loading…
Reference in New Issue
Block a user