diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-09 07:32:38 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-09 07:32:38 +0800 |
commit | 0f1cdfa53ad445df7bf3aed281fc36e53ecbbfd4 (patch) | |
tree | 4acfaeb81842b085838008583800917387e97002 /cmd/utils | |
parent | 81ceac1b96bdd61b9f2f80359607e451061fc02f (diff) | |
parent | 4ab0cedf42abea8becc5177e566c070730f13a07 (diff) | |
download | dexon-0f1cdfa53ad445df7bf3aed281fc36e53ecbbfd4.tar.gz dexon-0f1cdfa53ad445df7bf3aed281fc36e53ecbbfd4.tar.zst dexon-0f1cdfa53ad445df7bf3aed281fc36e53ecbbfd4.zip |
Merge pull request #1193 from tgerring/hotbackup
Improve export command
Diffstat (limited to 'cmd/utils')
-rw-r--r-- | cmd/utils/cmd.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index e5413973d..f7520a8e4 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -268,3 +268,18 @@ func ExportChain(chainmgr *core.ChainManager, fn string) error { glog.Infoln("Exported blockchain to", fn) return nil } + +func ExportAppendChain(chainmgr *core.ChainManager, fn string, first uint64, last uint64) error { + glog.Infoln("Exporting blockchain to", fn) + // TODO verify mode perms + fh, err := os.OpenFile(fn, os.O_CREATE|os.O_APPEND|os.O_WRONLY, os.ModePerm) + if err != nil { + return err + } + defer fh.Close() + if err := chainmgr.ExportN(fh, first, last); err != nil { + return err + } + glog.Infoln("Exported blockchain to", fn) + return nil +} |