We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4873a6c commit 95614d0Copy full SHA for 95614d0
src/node/history.h
@@ -612,7 +612,6 @@ namespace ccf
612
bool init_from_snapshot(
613
const std::vector<uint8_t>& hash_at_snapshot) override
614
{
615
- std::lock_guard<ccf::pal::Mutex> guard(state_lock);
616
// The history can be initialised after a snapshot has been applied by
617
// deserialising the tree in the signatures table and then applying the
618
// hash of the transaction at which the snapshot was taken
@@ -626,6 +625,10 @@ namespace ccf
626
625
return false;
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
+
632
CCF_ASSERT_FMT(
633
!replicated_state_tree.in_range(1),
634
"Tree is not empty before initialising from snapshot");
0 commit comments