Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit cb7bc25

Browse files
authored
Merge pull request #5258 from s1na/ci/geth-preload
2 parents 7d2a78c + c0a07da commit cb7bc25

File tree

3 files changed

+32
-27
lines changed

3 files changed

+32
-27
lines changed

scripts/ci.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ set -o errexit
66
run_geth() {
77
docker run \
88
-v /$PWD/scripts:/scripts \
9+
-t \
910
-d \
1011
-p 8545:8545 \
1112
-p 8546:8546 \
1213
-p 30303:30303 \
13-
ethereum/client-go:v1.10.19 \
14+
ethereum/client-go:stable \
1415
--http \
1516
--http.addr '0.0.0.0' \
1617
--http.port 8545 \
@@ -22,7 +23,8 @@ run_geth() {
2223
--dev \
2324
--dev.period 0 \
2425
--allow-insecure-unlock \
25-
js ./scripts/geth-accounts.js \
26+
--preload ./scripts/geth-accounts.js \
27+
console \
2628
>/dev/null &
2729
}
2830

scripts/geth-accounts.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ function createAccounts() {
1919
function unlockAccounts() {
2020
eth.accounts.forEach(function (account) {
2121
console.log('Unlocking ' + account + '...');
22-
personal.unlockAccount(account, '', 86400);
22+
personal.unlockAccount(account, '', 0);
2323
});
2424
}
2525

2626
function setupDevNode() {
2727
// keep accounts unlocked
28-
while (true) {
29-
unlockAccounts();
30-
}
28+
unlockAccounts();
3129
}
3230

3331
createAccounts();
34-
setupDevNode();
32+
setupDevNode();

scripts/geth.sh

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
#!/usr/bin/env bash
22

3-
docker pull ethereum/client-go:v1.10.19
3+
docker pull ethereum/client-go:stable
44

5-
docker run \
6-
-v /$PWD/scripts:/scripts \
7-
-i \
8-
-p 8545:8545 \
9-
-p 8546:8546 \
10-
-p 30303:30303 \
11-
ethereum/client-go:v1.10.19 \
12-
--http \
13-
--http.addr '0.0.0.0' \
14-
--http.port 8545 \
15-
--http.corsdomain '*' \
16-
--ws \
17-
--ws.addr '0.0.0.0' \
18-
--ws.origins '*' \
19-
--nodiscover \
20-
--dev \
21-
--dev.period 0 \
22-
--allow-insecure-unlock \
23-
js ./scripts/geth-accounts.js
5+
CID=$(docker run \
6+
-v /$PWD/scripts:/scripts \
7+
-t \
8+
-d \
9+
-p 8545:8545 \
10+
-p 8546:8546 \
11+
-p 30303:30303 \
12+
ethereum/client-go:stable \
13+
--http \
14+
--http.addr '0.0.0.0' \
15+
--http.port 8545 \
16+
--http.corsdomain '*' \
17+
--ws \
18+
--ws.addr '0.0.0.0' \
19+
--ws.origins '*' \
20+
--nodiscover \
21+
--dev \
22+
--dev.period 0 \
23+
--allow-insecure-unlock \
24+
--preload ./scripts/geth-accounts.js \
25+
console)
26+
27+
printf "Geth running in docker container ${CID}\n"
28+
printf "Connect to geth:\n docker exec -it ${CID:0:8} geth attach http://localhost:8545 console\n"

0 commit comments

Comments
 (0)