@@ -40,7 +40,7 @@ ADD genesis.json /genesis.json
4040RUN \
4141 echo '/geth init /genesis.json' > geth.sh && \{{if .Unlock}}
4242 echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}}
43- echo $'/geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes }}--bootnodes {{.Bootnodes }}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine{{end}}{{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}}' >> geth.sh
43+ echo $'/geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .BootV4 }}--bootnodesv4 {{.BootV4 }}{{end}} {{if .BootV5}}--bootnodesv5 {{.BootV5}}{{end}} {{if . Etherbase}}--etherbase {{.Etherbase}} --mine{{end}}{{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice }}' >> geth.sh
4444
4545ENTRYPOINT ["/bin/sh", "geth.sh"]
4646`
@@ -66,17 +66,20 @@ services:
6666 - LIGHT_PEERS={{.LightPeers}}
6767 - STATS_NAME={{.Ethstats}}
6868 - MINER_NAME={{.Etherbase}}
69+ - GAS_TARGET={{.GasTarget}}
70+ - GAS_PRICE={{.GasPrice}}
6971 restart: always
7072`
7173
7274// deployNode deploys a new Ethereum node container to a remote machine via SSH,
7375// docker and docker-compose. If an instance with the specified network name
7476// already exists there, it will be overwritten!
75- func deployNode (client * sshClient , network string , bootnodes []string , config * nodeInfos ) ([]byte , error ) {
77+ func deployNode (client * sshClient , network string , bootv4 , bootv5 []string , config * nodeInfos ) ([]byte , error ) {
7678 kind := "sealnode"
7779 if config .keyJSON == "" && config .etherbase == "" {
7880 kind = "bootnode"
79- bootnodes = make ([]string , 0 )
81+ bootv4 = make ([]string , 0 )
82+ bootv5 = make ([]string , 0 )
8083 }
8184 // Generate the content to upload to the server
8285 workdir := fmt .Sprintf ("%d" , rand .Int63 ())
@@ -92,9 +95,12 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
9295 "Port" : config .portFull ,
9396 "Peers" : config .peersTotal ,
9497 "LightFlag" : lightFlag ,
95- "Bootnodes" : strings .Join (bootnodes , "," ),
98+ "BootV4" : strings .Join (bootv4 , "," ),
99+ "BootV5" : strings .Join (bootv5 , "," ),
96100 "Ethstats" : config .ethstats ,
97101 "Etherbase" : config .etherbase ,
102+ "GasTarget" : uint64 (1000000 * config .gasTarget ),
103+ "GasPrice" : uint64 (1000000000 * config .gasPrice ),
98104 "Unlock" : config .keyJSON != "" ,
99105 })
100106 files [filepath .Join (workdir , "Dockerfile" )] = dockerfile .Bytes ()
@@ -111,6 +117,8 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
111117 "LightPeers" : config .peersLight ,
112118 "Ethstats" : config .ethstats [:strings .Index (config .ethstats , ":" )],
113119 "Etherbase" : config .etherbase ,
120+ "GasTarget" : config .gasTarget ,
121+ "GasPrice" : config .gasPrice ,
114122 })
115123 files [filepath .Join (workdir , "docker-compose.yaml" )] = composefile .Bytes ()
116124
@@ -147,6 +155,8 @@ type nodeInfos struct {
147155 etherbase string
148156 keyJSON string
149157 keyPass string
158+ gasTarget float64
159+ gasPrice float64
150160}
151161
152162// String implements the stringer interface.
@@ -155,7 +165,8 @@ func (info *nodeInfos) String() string {
155165 if info .peersLight > 0 {
156166 discv5 = fmt .Sprintf (", portv5=%d" , info .portLight )
157167 }
158- return fmt .Sprintf ("port=%d%s, datadir=%s, peers=%d, lights=%d, ethstats=%s" , info .portFull , discv5 , info .datadir , info .peersTotal , info .peersLight , info .ethstats )
168+ return fmt .Sprintf ("port=%d%s, datadir=%s, peers=%d, lights=%d, ethstats=%s, gastarget=%0.3f MGas, gasprice=%0.3f GWei" ,
169+ info .portFull , discv5 , info .datadir , info .peersTotal , info .peersLight , info .ethstats , info .gasTarget , info .gasPrice )
159170}
160171
161172// checkNode does a health-check against an boot or seal node server to verify
@@ -176,6 +187,8 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
176187 // Resolve a few types from the environmental variables
177188 totalPeers , _ := strconv .Atoi (infos .envvars ["TOTAL_PEERS" ])
178189 lightPeers , _ := strconv .Atoi (infos .envvars ["LIGHT_PEERS" ])
190+ gasTarget , _ := strconv .ParseFloat (infos .envvars ["GAS_TARGET" ], 64 )
191+ gasPrice , _ := strconv .ParseFloat (infos .envvars ["GAS_PRICE" ], 64 )
179192
180193 // Container available, retrieve its node ID and its genesis json
181194 var out []byte
@@ -213,6 +226,8 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
213226 etherbase : infos .envvars ["MINER_NAME" ],
214227 keyJSON : keyJSON ,
215228 keyPass : keyPass ,
229+ gasTarget : gasTarget ,
230+ gasPrice : gasPrice ,
216231 }
217232 stats .enodeFull = fmt .Sprintf ("enode://%s@%s:%d" , id , client .address , stats .portFull )
218233 if stats .portLight != 0 {
0 commit comments