chaindb: fix reset atomicity.

This commit is contained in:
Christopher Jeffrey 2016-09-03 16:51:32 -07:00
parent ae2f90890a
commit 28acda024a
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -224,12 +224,13 @@ ChainDB.prototype._open = function open(callback) {
return callback(err);
self.logger.info('Chain successfully loaded.');
self.logger.info('Chain State: hash=%s tx=%d coin=%d value=%s.',
self.logger.info(
'Chain State: hash=%s tx=%d coin=%d value=%s.',
self.state.rhash,
self.state.tx,
self.state.coin,
utils.btc(self.state.value)
);
utils.btc(self.state.value));
self.db.checkVersion('V', 1, callback);
}
@ -846,6 +847,8 @@ ChainDB.prototype.reset = function reset(block, callback) {
return callback(err);
}
self.put(layout.R, self.pending.commit(tip.prevBlock));
self.commit(function(err) {
if (err)
return next(err);