We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 728d5df commit d8020c0Copy full SHA for d8020c0
src/node/history.h
@@ -674,7 +674,6 @@ namespace ccf
674
bool init_from_snapshot(
675
const std::vector<uint8_t>& hash_at_snapshot) override
676
{
677
- std::lock_guard<ccf::pal::Mutex> guard(state_lock);
678
// The history can be initialised after a snapshot has been applied by
679
// deserialising the tree in the signatures table and then applying the
680
// hash of the transaction at which the snapshot was taken
@@ -688,6 +687,10 @@ namespace ccf
688
687
return false;
689
}
690
+ // Delay taking this lock until _after_ the read above, to avoid lock
691
+ // inversions
692
+ std::lock_guard<ccf::pal::Mutex> guard(state_lock);
693
+
694
CCF_ASSERT_FMT(
695
!replicated_state_tree.in_range(1),
696
"Tree is not empty before initialising from snapshot");
0 commit comments