aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-12-03 18:03:16 +0000
committerglozow <gloriajzhao@gmail.com>2021-12-06 15:30:06 +0000
commitb4adc5ad6769e4a5a6179dfff271cd4c9dc47a5b (patch)
treef1480b9141908f2299d160790de098bc7590159b /src/validation.cpp
parentb6002b07a36f0d58dc6becd04bfcf78599056b7c (diff)
[bugfix] update lockpoints correctly during reorg
During a reorg, we re-check timelocks on all mempool entries using CheckSequenceLocks(useExistingLockPoints=false) and remove any now-invalid entries. CheckSequenceLocks() also mutates the LockPoints passed in, and we update valid entries' LockPoints using update_lock_points. Thus, update_lock_points(lp) needs to be called right after CheckSequenceLocks(lp), otherwise we lose the data in lp. commit bedf246 introduced a bug by separating those two loops.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 203bd57676..68729e4863 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -378,6 +378,8 @@ void CChainState::MaybeUpdateMempoolForReorg(
}
}
}
+ // CheckSequenceLocks updates lp. Update the mempool entry LockPoints.
+ if (!validLP) m_mempool->mapTx.modify(it, update_lock_points(lp));
return should_remove;
};