diff options
author | Bas van Kervel <basvankervel@ziggo.nl> | 2015-04-13 16:13:52 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@ziggo.nl> | 2015-04-13 16:13:52 +0800 |
commit | 49a513bdebd7c4402b3a7f2f169a31c34f2ca9df (patch) | |
tree | 2cb976e970a8aa757ce31ee867970cf3d53ad15c /core/chain_manager.go | |
parent | 4de1e1609abb2e5be7e5cc5b8f206d305af8ce27 (diff) | |
download | dexon-49a513bdebd7c4402b3a7f2f169a31c34f2ca9df.tar.gz dexon-49a513bdebd7c4402b3a7f2f169a31c34f2ca9df.tar.zst dexon-49a513bdebd7c4402b3a7f2f169a31c34f2ca9df.zip |
Added blockchain DB versioning support, closes #650
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r-- | core/chain_manager.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 5ad1dda83..25ee0eeef 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -284,11 +284,14 @@ func (self *ChainManager) Export(w io.Writer) error { defer self.mu.RUnlock() glog.V(logger.Info).Infof("exporting %v blocks...\n", self.currentBlock.Header().Number) - for block := self.currentBlock; block != nil; block = self.GetBlock(block.Header().ParentHash) { - if err := block.EncodeRLP(w); err != nil { + last := self.currentBlock.NumberU64() + + for nr := uint64(0); nr <= last; nr++ { + if err := self.GetBlockByNumber(nr).EncodeRLP(w); err != nil { return err } } + return nil } |