In both instances, the call to insert is followed by a call to update.
Potential Problem
insert and update each use separate WriteBatches to write their changes. This means that if a process running HotStuff-rs crashes after the changes of insert are written, but before the changes of update are written, the block tree could be left in an inconsistent state.
Question
I'm sure that Karolina must have ensured that crashing right after insert but before update is safe. What is the argument behind this? Let's find out and write documentation.
Affected version
v0.4 (branch:
dev/v0.4
)Background
BlockTree::insert
is called in two places in the library:HotStuff::on_receive_proposal
.BlockSync::insert
.In both instances, the call to
insert
is followed by a call toupdate
.Potential Problem
insert
andupdate
each use separateWriteBatch
es to write their changes. This means that if a process running HotStuff-rs crashes after the changes ofinsert
are written, but before the changes ofupdate
are written, the block tree could be left in an inconsistent state.Question
I'm sure that Karolina must have ensured that crashing right after
insert
but beforeupdate
is safe. What is the argument behind this? Let's find out and write documentation.