diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-06-06 12:02:32 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-06-06 12:02:32 +0800 |
commit | d65b64c8846636d3e58c1857eaff149d2f82a283 (patch) | |
tree | 3413f344f5a008750e841c2bb4abab5d92e31b0f /cmd/utils | |
parent | 89c9320d8000845ee144f12adee958a5ab2303ef (diff) | |
download | go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.tar go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.tar.gz go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.tar.bz2 go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.tar.lz go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.tar.xz go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.tar.zst go-tangerine-d65b64c8846636d3e58c1857eaff149d2f82a283.zip |
Allow export command to take first and last args
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 +} |