Closed JeremyPansier closed 1 year ago
In blockchain.go, neighbor.GetBlocks() calls must be done in goroutines
blockchain.go
neighbor.GetBlocks()
func (blockchain *Blockchain) Verify() { // Select valid blocks neighbors := blockchain.synchronizer.Neighbors() blockchain.mutex.RLock() blockResponsesByTarget := make(map[string][]*neighborhood.BlockResponse) blocksByTarget := make(map[string][]*Block) var selectedTargets []string for _, neighbor := range neighbors { neighborBlocks, err := neighbor.GetBlocks() target := neighbor.Target() blockResponsesByTarget[target] = neighborBlocks if err == nil { var validBlocks []*Block validBlocks, err = blockchain.getValidBlocks(neighborBlocks) if err != nil || validBlocks == nil { blockchain.logger.Debug(fmt.Errorf("failed to verify blocks for neighbor %s: %w", target, err).Error()) } else { blocksByTarget[target] = validBlocks selectedTargets = append(selectedTargets, target) } } }
In
blockchain.go
,neighbor.GetBlocks()
calls must be done in goroutines