Re-introduce nInstantSendKeepLock check for LLMQ-based IS when spork19 is OFF (#2829)

This commit is contained in:
UdjinM6 2019-04-05 06:55:30 +03:00 committed by Alexander Block
parent 92c1cdcb81
commit 208406df71
3 changed files with 19 additions and 0 deletions

View File

@ -60,6 +60,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
if (fLiteMode)
return;
llmq::quorumInstantSendManager->UpdatedBlockTip(pindexNew);
llmq::chainLocksHandler->UpdatedBlockTip(pindexNew, pindexFork);
CPrivateSend::UpdatedBlockTip(pindexNew);

View File

@ -798,6 +798,23 @@ void CInstantSendManager::NotifyChainLock(const CBlockIndex* pindexChainLock)
RetryLockTxs(uint256());
}
void CInstantSendManager::UpdatedBlockTip(const CBlockIndex* pindexNew)
{
if (sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
// Nothing to do here. We should keep all islocks and let chainlocks handle them.
return;
}
int nChainLockMinHeight = pindexNew->nHeight - Params().GetConsensus().nInstantSendKeepLock;
const CBlockIndex* pindex = pindexNew->GetAncestor(nChainLockMinHeight);
if (pindex) {
// Pretend it was chainlocked at nChainLockMinHeight.
// This effectively drops all islocks below nChainLockMinHeight.
NotifyChainLock(pindex);
}
}
void CInstantSendManager::RemoveFinalISLock(const uint256& hash, const CInstantSendLockPtr& islock)
{
AssertLockHeld(cs);

View File

@ -122,6 +122,7 @@ public:
void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock);
void NotifyChainLock(const CBlockIndex* pindexChainLock);
void UpdatedBlockTip(const CBlockIndex* pindexNew);
void RemoveFinalISLock(const uint256& hash, const CInstantSendLockPtr& islock);
void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock);