-
Notifications
You must be signed in to change notification settings - Fork 10
/
create_geths.sh
55 lines (36 loc) · 1.72 KB
/
create_geths.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
BASE=`pwd`
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum
git checkout eee96a5b
git checkout -b fixeddiff
mv core/block_validator.go core/block_validator.go.template
#mv consensus/ethash/consensus.go consensus/ethash/consensus.go.template
mv circle.yml circle.yml.template
mv vendor/github.com/ethereum/ethash/ethash.go vendor/github.com/ethereum/ethash/ethash.go.template
sed -i '268s/.*/return big.NewInt(MININGDIFF)/' core/block_validator.go.template
sed -i '270s/.*/return big.NewInt(MININGDIFF)/' core/block_validator.go.template
#sed -i '284s/.*/return big.NewInt(MININGDIFF)/' consensus/ethash/consensus.go.template
#sed -i '286s/.*/return big.NewInt(MININGDIFF)/' consensus/ethash/consensus.go.template
sed -i '7s/ethash/ethashMYNUMBER/' circle.yml.template
sed -i '70s/ethash/ethashMYNUMBER/' vendor/github.com/ethereum/ethash/ethash.go.template
RESERVEDNODES=(0)
TEMPLATEA="$BASE/go-ethereum/circle.yml.template"
TEMPLATEB="$BASE/go-ethereum/vendor/github.com/ethereum/ethash/ethash.go.template"
TEMPLATEC="$BASE/go-ethereum/core/block_validator.go.template"
if [ $# -eq 0 ]
then
MININGDIFF=200000
else
MININGDIFF=$1
fi
for i in $RESERVEDNODES; do
cp -r "$BASE/go-ethereum/" "$BASE/go-ethereum${i}"
OUTFILEA="$BASE/go-ethereum${i}/circle.yml"
sed -e "s|MYNUMBER|$i|g" $TEMPLATEA > $OUTFILEA
OUTFILEB="$BASE/go-ethereum${i}/vendor/github.com/ethereum/ethash/ethash.go"
sed -e "s|MYNUMBER|$i|g" $TEMPLATEB > $OUTFILEB
OUTFILEC="$BASE/go-ethereum${i}/core/block_validator.go"
sed -e "s|MININGDIFF|$MININGDIFF|g" $TEMPLATEC > $OUTFILEC
make -C "$BASE/go-ethereum${i}"
mv "$BASE/go-ethereum${i}/build/bin/geth" "$BASE/go-ethereum${i}/build/bin/geth${i}"
done