Skip to content

Commit a219030

Browse files
committed
Fix case with 1 miner
1 parent a1a618f commit a219030

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sqlchain/chain.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,13 @@ func (c *Chain) syncHead() (err error) {
583583
child, cancel = context.WithTimeout(c.rt.ctx, c.rt.tick)
584584
wg = &sync.WaitGroup{}
585585

586-
succCount uint32
586+
totalCount, succCount uint32
587587
)
588588
defer func() {
589589
wg.Wait()
590590
cancel()
591591

592-
if succCount == 0 {
592+
if totalCount > 0 && succCount == 0 {
593593
// Set error if all RPC calls are failed
594594
err = errors.New("all remote peers are unreachable")
595595
}
@@ -602,6 +602,7 @@ func (c *Chain) syncHead() (err error) {
602602
}
603603

604604
wg.Add(1)
605+
totalCount++
605606
go func(i int, node proto.NodeID) {
606607
defer wg.Done()
607608
var (

0 commit comments

Comments
 (0)