File tree Expand file tree Collapse file tree 7 files changed +78
-3
lines changed Expand file tree Collapse file tree 7 files changed +78
-3
lines changed Original file line number Diff line number Diff line change
1
+ vendor
Original file line number Diff line number Diff line change
1
+ # PoS-Lachesis node
2
+
3
+ Package assembles functionality of [ network node] ( ../posnode/ ) and [ consensus] ( ../posposet/ ) into solid Lachesis-node.
4
+
5
+
6
+ ### Executables
7
+
8
+ [ ` cmd/ ` ] ( ./cmd/ ) - contains cli (only for fakenet now):
9
+
10
+ - run single node: ` go run main.go ` ;
11
+ - for args see ` go run main.go --help ` ;
12
+ - build: ` go build . ` ;
13
+
14
+
15
+ ### Docker
16
+
17
+ [ ` docker/ ` ] ( ./docker/ ) - contains docker scripts to try lachesis fakenet:
18
+
19
+ - build node docker image "pos-lachesis": ` make ` ;
20
+ - run network of N nodes: ` n=N ./start.sh ` ;
21
+ - drop network: ` ./stop.sh ` ;
Original file line number Diff line number Diff line change
1
+ FROM golang:1.12 as build
2
+
3
+ WORKDIR /go/src/github.com/Fantom-foundation/go-lachesis
4
+ COPY . .
5
+
6
+ RUN go get github.com/Masterminds/glide
7
+
8
+ RUN glide install && CGO_ENABLED=0 go build -ldflags "-s -w" -o /tmp/lachesis ./src/poslachesis/cmd
9
+
10
+
11
+
12
+ FROM scratch as prod
13
+
14
+ COPY --from=build /tmp/lachesis /
15
+
16
+ EXPOSE 55555 55556
17
+
18
+ ENTRYPOINT ["/lachesis" ]
Original file line number Diff line number Diff line change
1
+ .PHONY : build start stop
2
+
3
+ all : build
4
+
5
+
6
+ build :
7
+ cd ../../.. && docker build -f src/poslachesis/docker/Dockerfile -t " pos-lachesis" .
8
+
9
+ start :
10
+ ./start.sh
11
+
12
+ stop :
13
+ ./stop.sh
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ declare -ri n=" ${n:- 3} "
4
+
5
+ docker network create lachesis
6
+
7
+ limit_cpu=$( echo " scale=2; 1/$n " | bc)
8
+ limit_io=$( echo " 500/$n " | bc)
9
+ limits=" --cpus=${limit_cpu} --blkio-weight=${limit_io} "
10
+
11
+ for i in $( seq $n )
12
+ do
13
+ j=$(( $i % $n + 1 )) # ring
14
+ docker run -d --rm --name=pos-lachesis-node-$i ${limits} --net=lachesis " pos-lachesis" --fakegen=$i /$n --db=/tmp --peer=pos-lachesis-node-$j
15
+ done
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ docker ps -q --filter " network=lachesis" | while read id
4
+ do
5
+ docker stop $id
6
+ done
7
+
8
+ docker network rm lachesis
Original file line number Diff line number Diff line change @@ -24,9 +24,8 @@ func (n *Node) StartEventEmission() {
24
24
return
25
25
}
26
26
n .emitter .done = make (chan struct {})
27
- done := n .emitter .done
28
27
29
- go func () {
28
+ go func (done chan struct {} ) {
30
29
ticker := time .NewTicker (n .conf .EmitInterval )
31
30
for {
32
31
select {
@@ -36,7 +35,7 @@ func (n *Node) StartEventEmission() {
36
35
return
37
36
}
38
37
}
39
- }()
38
+ }(n . emitter . done )
40
39
}
41
40
42
41
// StopEventEmission stops event emission.
You can’t perform that action at this time.
0 commit comments