-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make sure mempool txes are properly processed by CChainLocksHandler despite node restarts #3226
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
src/llmq/quorums_chainlocks.cpp
Outdated
return false; | ||
} | ||
LOCK(cs); | ||
txFirstSeenTime.emplace(txid, info.nTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Dropped this commit and updated PR description.
06e20a8
to
f3e933c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
…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
…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]>
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