summaryrefslogtreecommitdiff
path: root/regional-currency/list-incoming.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regional-currency/list-incoming.sh')
-rwxr-xr-xregional-currency/list-incoming.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/regional-currency/list-incoming.sh b/regional-currency/list-incoming.sh
new file mode 100755
index 0000000..bb3a67d
--- /dev/null
+++ b/regional-currency/list-incoming.sh
@@ -0,0 +1,33 @@
+#!/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
+
+exchange_db=$(taler-config -s exchangedb-postgres -o config)
+
+# 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
+