forked from TrueCloudLab/neoneo-go
consensus: perform batched chain's block sync
If there are several blocks from chain, then initialize consensus only for the latest one.
This commit is contained in:
parent
0b352349eb
commit
c7566c2a01
1 changed files with 5 additions and 2 deletions
|
@ -345,15 +345,18 @@ events:
|
||||||
}
|
}
|
||||||
// Always process block event if there is any, we can add one above or external
|
// Always process block event if there is any, we can add one above or external
|
||||||
// services can add several blocks during message processing.
|
// services can add several blocks during message processing.
|
||||||
|
var latestBlock *coreb.Block
|
||||||
syncLoop:
|
syncLoop:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case b := <-s.blockEvents:
|
case latestBlock = <-s.blockEvents:
|
||||||
s.handleChainBlock(b)
|
|
||||||
default:
|
default:
|
||||||
break syncLoop
|
break syncLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if latestBlock != nil {
|
||||||
|
s.handleChainBlock(latestBlock)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
drainLoop:
|
drainLoop:
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Reference in a new issue