OSDN Git Service

upload (#576)
[bytom/vapor.git] / toolbar / osssync / sync / sync.go
1 package sync
2
3 import (
4         "github.com/bytom/vapor/protocol"
5         "github.com/bytom/vapor/protocol/bc/types"
6 )
7
8 // GetLatestDownloadBlockHeight returns the current height of the node wait for download.
9 func GetLatestDownloadBlockHeight(c *protocol.Chain) uint64 {
10         return c.BestBlockHeight()
11 }
12
13 // Sync
14 func Sync(c *protocol.Chain, blocks []*types.Block) error {
15         for i := 0; i < len(blocks); i++ {
16                 _, err := c.ProcessBlock(blocks[i])
17                 if err != nil {
18                         return err
19                 }
20         }
21         return nil
22 }