[era/xml restorer] bug fixes

This commit is contained in:
Joe Thornber 2014-08-21 11:22:12 +01:00
parent 5465c95134
commit 1a632f9d53

View File

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