File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -674,7 +674,6 @@ namespace ccf
674
674
bool init_from_snapshot (
675
675
const std::vector<uint8_t >& hash_at_snapshot) override
676
676
{
677
- std::lock_guard<ccf::pal::Mutex> guard (state_lock);
678
677
// The history can be initialised after a snapshot has been applied by
679
678
// deserialising the tree in the signatures table and then applying the
680
679
// hash of the transaction at which the snapshot was taken
@@ -688,6 +687,10 @@ namespace ccf
688
687
return false ;
689
688
}
690
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
+
691
694
CCF_ASSERT_FMT (
692
695
!replicated_state_tree.in_range (1 ),
693
696
" Tree is not empty before initialising from snapshot" );
You can’t perform that action at this time.
0 commit comments