aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-05-28 07:16:57 +0800
committerFelix Lange <fjl@twurst.com>2015-05-28 07:20:58 +0800
commite1fe75e3b637758f99ddbcaeb01eafa1a0b6455e (patch)
tree425676c7a1d77de729c604254bd2c45a3995dbc0 /cmd
parenta8bc2181c94f5d3a9455c4fa526f8722a21ecb04 (diff)
downloaddexon-e1fe75e3b637758f99ddbcaeb01eafa1a0b6455e.tar.gz
dexon-e1fe75e3b637758f99ddbcaeb01eafa1a0b6455e.tar.zst
dexon-e1fe75e3b637758f99ddbcaeb01eafa1a0b6455e.zip
cmd/utils: use constant for import batch size
Diffstat (limited to 'cmd')
-rw-r--r--cmd/utils/cmd.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 2a5e2ec6a..e5413973d 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -40,6 +40,10 @@ import (
"github.com/peterh/liner"
)
+const (
+ importBatchSize = 2500
+)
+
var interruptCallbacks = []func(os.Signal){}
// Register interrupt handlers callbacks
@@ -205,8 +209,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
stream := rlp.NewStream(fh, 0)
// Run actual the import.
- batchSize := 2500
- blocks := make(types.Blocks, batchSize)
+ blocks := make(types.Blocks, importBatchSize)
n := 0
for batch := 0; ; batch++ {
// Load a batch of RLP blocks.
@@ -214,7 +217,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
return fmt.Errorf("interrupted")
}
i := 0
- for ; i < batchSize; i++ {
+ for ; i < importBatchSize; i++ {
var b types.Block
if err := stream.Decode(&b); err == io.EOF {
break