Skip to content

Commit 208406d

Browse files
UdjinM6codablock
authored andcommitted
Re-introduce nInstantSendKeepLock check for LLMQ-based IS when spork19 is OFF (#2829)
1 parent 92c1cdc commit 208406d

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/dsnotificationinterface.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
6060
if (fLiteMode)
6161
return;
6262

63+
llmq::quorumInstantSendManager->UpdatedBlockTip(pindexNew);
6364
llmq::chainLocksHandler->UpdatedBlockTip(pindexNew, pindexFork);
6465

6566
CPrivateSend::UpdatedBlockTip(pindexNew);

src/llmq/quorums_instantsend.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,23 @@ void CInstantSendManager::NotifyChainLock(const CBlockIndex* pindexChainLock)
798798
RetryLockTxs(uint256());
799799
}
800800

801+
void CInstantSendManager::UpdatedBlockTip(const CBlockIndex* pindexNew)
802+
{
803+
if (sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) {
804+
// Nothing to do here. We should keep all islocks and let chainlocks handle them.
805+
return;
806+
}
807+
808+
int nChainLockMinHeight = pindexNew->nHeight - Params().GetConsensus().nInstantSendKeepLock;
809+
const CBlockIndex* pindex = pindexNew->GetAncestor(nChainLockMinHeight);
810+
811+
if (pindex) {
812+
// Pretend it was chainlocked at nChainLockMinHeight.
813+
// This effectively drops all islocks below nChainLockMinHeight.
814+
NotifyChainLock(pindex);
815+
}
816+
}
817+
801818
void CInstantSendManager::RemoveFinalISLock(const uint256& hash, const CInstantSendLockPtr& islock)
802819
{
803820
AssertLockHeld(cs);

src/llmq/quorums_instantsend.h

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class CInstantSendManager : public CRecoveredSigsListener
122122

123123
void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock);
124124
void NotifyChainLock(const CBlockIndex* pindexChainLock);
125+
void UpdatedBlockTip(const CBlockIndex* pindexNew);
125126
void RemoveFinalISLock(const uint256& hash, const CInstantSendLockPtr& islock);
126127

127128
void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock);

0 commit comments

Comments
 (0)