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 @@ -612,7 +612,6 @@ namespace ccf
612
612
bool init_from_snapshot (
613
613
const std::vector<uint8_t >& hash_at_snapshot) override
614
614
{
615
- std::lock_guard<ccf::pal::Mutex> guard (state_lock);
616
615
// The history can be initialised after a snapshot has been applied by
617
616
// deserialising the tree in the signatures table and then applying the
618
617
// hash of the transaction at which the snapshot was taken
@@ -626,6 +625,10 @@ namespace ccf
626
625
return false ;
627
626
}
628
627
628
+ // Delay taking this lock until _after_ the read above, to avoid lock
629
+ // inversions
630
+ std::lock_guard<ccf::pal::Mutex> guard (state_lock);
631
+
629
632
CCF_ASSERT_FMT (
630
633
!replicated_state_tree.in_range (1 ),
631
634
" Tree is not empty before initialising from snapshot" );
You can’t perform that action at this time.
0 commit comments