|
2 | 2 |
|
3 | 3 | set -em
|
4 | 4 |
|
5 |
| -rm -rf test-01-dir |
6 |
| -mkdir test-01-dir test-01-dir/p1 test-01-dir/p2 |
| 5 | +mkdir $1/p1 $1/p2 |
7 | 6 |
|
8 | 7 | NEWBLOCK=100100000800000000000000010002dcf2b3ff756f4c39c16a417e69138d79ce03488dda58e4f53cf640b3a99b91de4e8561afa441badda92600000028000000521f00001201212a5b494784a924f2e0249bf4c268af1d0e000000006d07571dee2e35e1378bc43a8e1388d2fef6b3021cc9924b885d53b2ce390ea86d07571dee2e35e1378bc43a8e1388d2fef6b3021cc9924b885d53b2ce390ea86d07571dee2e35e1378bc43a8e1388d2fef6b3021cc9924b885d53b2ce390ea86d07571dee2e35e1378bc43a8e1388d2fef6b3021cc9924b885d53b2ce390ea83e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e449ee153c4ff3b1d7a7f0901
|
9 | 8 |
|
10 | 9 | # Unpack their blockfiles.
|
11 |
| -xzcat test-01-blockfile1.xz > test-01-dir/p1/blockfile |
12 |
| -xzcat test-01-blockfile2.xz > test-01-dir/p2/blockfile |
| 10 | +xzcat test-01-blockfile1.xz > $1/p1/blockfile |
| 11 | +xzcat test-01-blockfile2.xz > $1/p2/blockfile |
13 | 12 |
|
14 | 13 | # Make sure they find each other.
|
15 |
| -touch test-01-dir/addresses |
16 |
| -ln -sf ../addresses test-01-dir/p1/addresses |
17 |
| -ln -sf ../addresses test-01-dir/p2/addresses |
| 14 | +touch $1/addresses |
| 15 | +ln -sf ../addresses $1/p1/addresses |
| 16 | +ln -sf ../addresses $1/p2/addresses |
18 | 17 |
|
19 |
| -# Core dumps please! |
20 |
| -ulimit -c unlimited |
21 |
| - |
22 |
| -../../pettycoin --seeding --developer-test --pettycoin-dir=test-01-dir/p1 > test-01-dir/p1.log 2>&1 & |
23 |
| -../../pettycoin --seeding --developer-test --pettycoin-dir=test-01-dir/p2 > test-01-dir/p2.log 2>&1 & |
| 18 | +../../pettycoin --seeding --developer-test --pettycoin-dir=$1/p1 > $1/p1.log 2>&1 & |
| 19 | +../../pettycoin --seeding --developer-test --pettycoin-dir=$1/p2 > $1/p2.log 2>&1 & |
24 | 20 |
|
25 | 21 | # They should complete within 1 minute.
|
26 | 22 | END=$(( $(date +%s) + 60 ))
|
27 | 23 |
|
28 | 24 | # Wait for startup
|
29 | 25 | while [ $(date +%s) -lt $END ]; do
|
30 |
| - if ../../pettycoin-query --pettycoin-dir=test-01-dir/p1 help >/dev/null 2>&1 && ../../pettycoin-query --pettycoin-dir=test-01-dir/p2 help >/dev/null 2>&1; then |
| 26 | + if ../../pettycoin-query --pettycoin-dir=$1/p1 help >/dev/null 2>&1 && ../../pettycoin-query --pettycoin-dir=$1/p2 help >/dev/null 2>&1; then |
31 | 27 | break;
|
32 | 28 | fi
|
33 | 29 | sleep 5
|
34 | 30 | done
|
35 | 31 |
|
36 | 32 | # Give P1 new block, will trigger P2 to ask.
|
37 |
| -../../pettycoin-query --pettycoin-dir=test-01-dir/p1 submitblock $NEWBLOCK |
| 33 | +../../pettycoin-query --pettycoin-dir=$1/p1 submitblock $NEWBLOCK |
38 | 34 |
|
39 | 35 | while [ $(date +%s) -lt $END ]; do
|
40 |
| - DEPTH1=`../../pettycoin-query --pettycoin-dir=test-01-dir/p1 getinfo | sed -n 's/.*"height" : \([0-9]\+\) .*num_todos.*/\1/p'` |
41 |
| - DEPTH2=`../../pettycoin-query --pettycoin-dir=test-01-dir/p2 getinfo | sed -n 's/.*"height" : \([0-9]\+\) .*num_todos.*/\1/p'` |
| 36 | + DEPTH1=`../../pettycoin-query --pettycoin-dir=$1/p1 getinfo | sed -n 's/.*"height" : \([0-9]\+\) .*num_todos.*/\1/p'` |
| 37 | + DEPTH2=`../../pettycoin-query --pettycoin-dir=$1/p2 getinfo | sed -n 's/.*"height" : \([0-9]\+\) .*num_todos.*/\1/p'` |
42 | 38 | if [ "$DEPTH1" = "$DEPTH2" ]; then
|
43 |
| - ../../pettycoin-query --pettycoin-dir=test-01-dir/p1 stop |
44 |
| - ../../pettycoin-query --pettycoin-dir=test-01-dir/p2 stop |
| 39 | + ../../pettycoin-query --pettycoin-dir=$1/p1 stop |
| 40 | + ../../pettycoin-query --pettycoin-dir=$1/p2 stop |
45 | 41 | exit 0
|
46 | 42 | fi
|
47 | 43 | sleep 5
|
48 | 44 | done
|
49 | 45 | echo Timeout >&2
|
50 |
| -../../pettycoin-query --pettycoin-dir=test-01-dir/p1 stop |
51 |
| -../../pettycoin-query --pettycoin-dir=test-01-dir/p2 stop |
| 46 | +../../pettycoin-query --pettycoin-dir=$1/p1 stop |
| 47 | +../../pettycoin-query --pettycoin-dir=$1/p2 stop |
52 | 48 | exit 1
|
0 commit comments