blob: fed431d0732387df2b8d883595c3e94f3a442a8f (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#!/bin/bash
## Test btc_wire ability to recover from errors in correctness critical paths
set -eu
# Cleanup to run whenever we exit
function cleanup() {
for n in `jobs -p`; do
kill $n 2> /dev/null || true
done
rm -rf $BTC_DIR 2> /dev/null
wait
}
# Install cleanup handler (except for kill -9)
trap cleanup EXIT
source "${BASH_SOURCE%/*}/setup.sh"
echo "---- Setup fail -----"
echo "Load config file"
load_config
echo "Reset database"
reset_db
echo "Start bitcoin node"
init_btc
echo "Init bitcoin regtest"
setup_btc
echo "Start failing btc-wire"
fail_btc_wire
echo "Start gateway"
gateway
echo ""
SEQ="seq 10 99"
function check() {
check_delta "$1?delta=-100" "$SEQ"
}
echo "----- Handle incoming -----"
echo -n "Making wire transfer to exchange:"
for n in `$SEQ`; do
btc-wire-cli -d $BTC_DIR transfer 0.0000$n
mine_btc # Mine transactions
done
next_btc # Trigger btc_wire
echo " OK"
echo -n "Requesting exchange incoming transaction list:"
check incoming
echo " OK"
echo -n "Check balance:"
check_balance 9.99438310 1.00490500
echo " OK"
echo "----- Handle outgoing -----"
echo -n "Making wire transfer from exchange:"
for n in `$SEQ`; do
taler-exchange-wire-gateway-client \
-b $BANK_ENDPOINT \
-C payto://bitcoin/$CLIENT \
-a BTC:0.0000$n > /dev/null
done
sleep 20
next_btc # Trigger watcher
sleep 20
next_btc # Mine transactions
echo " OK"
echo -n "Requesting exchange outgoing transaction list:"
check outgoing
echo " OK"
echo -n "Check balance:"
check_balance 9.99928810
echo " OK"
|