Skip to content

Commit

Permalink
Merge pull request tendermint#51 from binance-chain/fastsync_fix
Browse files Browse the repository at this point in the history
Fastsync fix
  • Loading branch information
ackratos authored Mar 5, 2019
2 parents 81e51fc + 34c7474 commit 25966b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions blockchain/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type BlockPool struct {
mtx sync.Mutex
// block requests
requesters map[int64]*bpRequester
initHeight int64
height int64 // the lowest key in requesters.
// peers
peers map[p2p.ID]*bpPeer
Expand All @@ -83,6 +84,7 @@ func NewBlockPool(start int64, requestsCh chan<- BlockRequest, errorsCh chan<- p
peers: make(map[p2p.ID]*bpPeer),

requesters: make(map[int64]*bpRequester),
initHeight: start,
height: start,
numPending: 0,

Expand Down
2 changes: 1 addition & 1 deletion blockchain/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ FOR_LOOP:
// numPending=0 total=0 outbound=1 inbound=0 height=6601 blocksSynced=0 poolHeight=6601 poolstarttime=2019-02-22T09:02:07.881888662Z poolMaxPeerHeight=6437 poolHeight=6601
// we need make sure blockstore has a block because when switch to consensus, it will verify the commit between block and state
// refer to `cs.blockStore.LoadSeenCommit(state.LastBlockHeight)`
if bcR.pool.IsCaughtUp() && (height == 1 || blocksSynced > 0) {
if bcR.pool.IsCaughtUp() && (height == bcR.pool.initHeight || blocksSynced > 0) {
bcR.Logger.Info("Time to switch to consensus reactor!", "height", height)
bcR.pool.Stop()

Expand Down

0 comments on commit 25966b7

Please sign in to comment.