blob: 1140d3891161f33190b55081f22fc683af6adbfd (
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
|
#!/usr/bin/env bash
# This file is in the public domain.
# Script for basic diagnostics of a Taler regio deployment.
# @author Florian Dold <dold@taler.net>
if [ "$(id -u)" -ne 0 ]; then
echo "FATAL: Please run as root." >&2
exit 1
fi
libeufin_bank_db=$(libeufin-bank config get libeufin-bankdb-postgres config)
libeufin_nexus_db=$(libeufin-nexus config get libeufin-nexusdb-postgres config)
exchange_db=$(taler-config -s exchangedb-postgres -o config)
if [[ $libeufin_nexus_db != $libeufin_bank_db ]]; then
echo "FATAL: libeufin-bank and libeufin-nexus don't share the same database" >&2
exit 1
fi
libeufin_db=$libeufin_bank_db
# runsql db RESNAME < query
function runsql() {
local sql
read -r -d '' sql
res=$(cd / && sudo -u postgres psql "$1" -t --csv -c "$sql")
printf -v "$2" '%s' "$res"
}
runsql "$exchange_db" reserves_in <<EOF
select reserve_pub from exchange.reserves_in;
EOF
mapfile -t lines <<<$reserves_in
for line in "${lines[@]}"; do
python3 -c "import binascii; import sys; sys.stdout.buffer.write(binascii.a2b_hex(sys.argv[1][2:]))" "$line" | gnunet-base32
echo
done
|