diff --git a/era/restore_emitter.cc b/era/restore_emitter.cc index aba16c0..c3465c0 100644 --- a/era/restore_emitter.cc +++ b/era/restore_emitter.cc @@ -29,11 +29,15 @@ namespace { sb.current_era = current_era; nr_blocks = nr_blocks; + + md_.era_array_->grow(nr_blocks, 0); + + in_superblock_ = true; } virtual void end_superblock() { if (!in_superblock_) - throw runtime_error("missing superblock"); + throw runtime_error("xml missing superblock"); md_.commit(); } @@ -42,6 +46,9 @@ namespace { if (!in_superblock_) throw runtime_error("missing superblock"); + if (in_writeset_) + throw runtime_error("attempt to begin writeset when already in one"); + in_writeset_ = true; era_ = era; @@ -56,6 +63,8 @@ namespace { virtual void end_writeset() { in_writeset_ = false; + bits_->flush(); + era_detail e; e.nr_bits = bits_->get_nr_bits(); e.writeset_root = bits_->get_root();