Added locks detected by race.

pull/4509/head
frozen 2 years ago committed by Casey Gardiner
parent c83b126fa8
commit 50f1c78944
  1. 5
      consensus/consensus_v2.go
  2. 1
      scripts/go_executable_build.sh

@ -310,16 +310,19 @@ func (consensus *Consensus) Start(
case <-stopChan: case <-stopChan:
return return
case <-ticker.C: case <-ticker.C:
consensus.mutex.Lock()
consensus.tick() consensus.tick()
consensus.mutex.Unlock()
} }
} }
}() }()
consensus.mutex.Lock()
consensus.consensusTimeout[timeoutBootstrap].Start() consensus.consensusTimeout[timeoutBootstrap].Start()
consensus.getLogger().Info().Msg("[ConsensusMainLoop] Start bootstrap timeout (only once)") consensus.getLogger().Info().Msg("[ConsensusMainLoop] Start bootstrap timeout (only once)")
// Set up next block due time. // Set up next block due time.
consensus.NextBlockDue = time.Now().Add(consensus.BlockPeriod) consensus.NextBlockDue = time.Now().Add(consensus.BlockPeriod)
consensus.mutex.Unlock()
}() }()
if consensus.dHelper != nil { if consensus.dHelper != nil {

@ -120,6 +120,7 @@ function build_only
if [ "$STATIC" == "true" ]; then if [ "$STATIC" == "true" ]; then
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY} -w -extldflags \"-static -lm\"" -o $BINDIR/$bin $RACE $TRACEPTR ${SRC[$bin]} env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY} -w -extldflags \"-static -lm\"" -o $BINDIR/$bin $RACE $TRACEPTR ${SRC[$bin]}
else else
# env GOOS=$GOOS GOARCH=$GOARCH go build -race $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE $TRACEPTR ${SRC[$bin]}
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE $TRACEPTR ${SRC[$bin]} env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE $TRACEPTR ${SRC[$bin]}
fi fi
fi fi

Loading…
Cancel
Save