Make sure mempool txes are properly processed by CChainLocksHandler despite node restarts#3226
Merged
UdjinM6 merged 2 commits intodashpay:developfrom Dec 7, 2019
Merged
Conversation
Otherwise the "first seen" time is way off after node restart
…is not synced yet Otherwise txes from mempool.dat won't be processed there
PastaPastaPasta
requested changes
Dec 6, 2019
codablock
reviewed
Dec 6, 2019
src/llmq/quorums_chainlocks.cpp
Outdated
There was a problem hiding this comment.
Hmm, I really don't like IsXXX methods with side effects. I'd prefer to not have this commit at all to be honest. Instead, we should maybe just do this on v0.14.0.x:
diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp
index cdb5d99ac1..221b8d0a9c 100644
--- a/src/llmq/quorums_chainlocks.cpp
+++ b/src/llmq/quorums_chainlocks.cpp
@@ -347,10 +347,6 @@ 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;
@@ -363,6 +359,10 @@ void CChainLocksHandler::SyncTransaction(const CTransaction& tx, const CBlockInd
txFirstSeenTime.emplace(tx.GetHash(), curTime);
}
+ if (!masternodeSync.IsBlockchainSynced()) {
+ return;
+ }
+
// We listen for SyncTransaction so that we can collect all TX ids of all included TXs of newly received blocks
// We need this information later when we try to sign a new tip, so that we can determine if all included TXs are
// safe.It'll cause TXs to linger in the mempool for 10 minutes, but that's still a lot better then never mining them.
Author
There was a problem hiding this comment.
Makes sense. Dropped this commit and updated PR description.
06e20a8 to
f3e933c
Compare
FornaxA
pushed a commit
to ioncoincore/ion
that referenced
this pull request
Jul 6, 2020
…espite node restarts (dashpay#3226) * Pass nAcceptTime via TransactionAddedToMempool and use it for ChainLocks Otherwise the "first seen" time is way off after node restart * Don't skip TransactionAddedToMempool for chainlocks while blockchain is not synced yet Otherwise txes from mempool.dat won't be processed there Signed-off-by: cevap <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pls see individual commits.
Note: the way txes are synced via signals has changed a lot since 0.14, so
I propose to backportit will need its own fix.06e20a8 to fix the same issue there while avoiding merge conflicts in the future