Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip processing in SyncTransaction when chain is not synced yet #2920

Merged
merged 1 commit into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Skip processing in SyncTransaction when chain is not synced yet
Applies to CInstantSendManager and CChainLocksHandler. This fixes extremely
high RAM usage on reindex and resync, which happens to many/all transactions
being kept track of non-locked TXs (nonLockedTxs) and TXs per
block (blockTxs).
  • Loading branch information
codablock committed May 13, 2019
commit a471bd6add673656454d5a426506958a41f94617
4 changes: 4 additions & 0 deletions src/llmq/quorums_chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ void CChainLocksHandler::TrySignChainTip()

void CChainLocksHandler::SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, int posInBlock)
{
if (!masternodeSync.IsBlockchainSynced()) {
return;
}

bool handleTx = true;
if (tx.IsCoinBase() || tx.vin.empty()) {
handleTx = false;
Expand Down
4 changes: 4 additions & 0 deletions src/llmq/quorums_instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,10 @@ void CInstantSendManager::SyncTransaction(const CTransaction& tx, const CBlockIn
}
}

if (!masternodeSync.IsBlockchainSynced()) {
return;
}

bool chainlocked = pindex && chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash());
if (islockHash.IsNull() && !chainlocked) {
ProcessTx(tx, Params().GetConsensus());
Expand Down