commit 1b7f10be69cba8903248fde3536c6ed29b9d27fb parent 8e0c127e916906477568e5ecd145d3ce49c90535 Author: Stefan Kügel <skuegel@web.de> Date: Tue, 20 Aug 2024 09:09:12 +0200 Merge branch 'master' of git+ssh://git.taler.net/exchange Diffstat:
99 files changed, 1758 insertions(+), 2766 deletions(-)
diff --git a/contrib/ci/debian-package-job.sh b/contrib/ci/debian-package-job.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -exuo pipefail +# This file is in the public domain. +# Helper script to build the latest DEB packages in the container. +# Shared between various jobs. + +unset LD_LIBRARY_PATH + +# Install build-time dependencies. +# Update apt cache first +apt-get update +apt-get upgrade -y +mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control + +export VERSION="$(./contrib/ci/version.sh)" +echo "Building package version ${VERSION}" +EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" +./bootstrap +dpkg-buildpackage -rfakeroot -b -uc -us + +ls -alh ../*.deb +mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment +mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ diff --git a/contrib/ci/jobs/000-codespell/job.sh b/contrib/ci/jobs/000-codespell/job.sh @@ -1,107 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -skip=$(cat <<EOF -ABOUT-NLS -*/afl-tests/* -**/auditor/*.sql -**/templating/test-specs/* -*.bbl -*.bib -*build-aux* -*.bst -*.cache/* -*/cbdc-es.tex -*/cbdc-it.tex -*.cls -configure* -config.status -config.guess -./src/include/taler_dbevents.h -*/contrib/* -*/contrib/hellos/** -*.dat -*.deflate -*.doc -*/doc/* -**/doc/flows/main.de.tex -*/doc/texinfo.tex -*.docx -*.ecc -*.eot -*.epgz -*.eps -*.epub -**/ExchangeSelection/example.ts -*.fee -*.fees -*.file -**/fonts/** -*.gif -*/.git/** -*.gz -*/i18n/strings.ts -*.info -*.jpeg -*.jpg -*.??.json -*.json -*/keys/* -*key -*.latexmkrc -*libtool* -*.log -*/m4/* -*.m4 -**/*.map -*.min.js -*.mp4 -*.odg -*.ods -*.odt -*.pack.js -*.pdf -*.png -*.PNG -**/pnpm-lock.yaml -*.po -*.pptx -*.priv -**/rfc.bib -*.rpath -**/signing-key.asc -*.sqlite -*/src/anastasis-data.ts -**/*.svg -*.svg -*.tag -**/templating/mustach** -*/templating/test?/** -*/testcurl/test_tricky.c -*/debian/tmp/** -*/debian/taler-exchange/** -*/debian/.debhelper/** -*/debian/autoreconf.before -*/debian/autoreconf.after -debian/taler-terms-generator/**/* -taler-terms-generator -*.tgz -*.ttf -*.ttf -**/valgrind.h -*/vpn/tests/** -*.wav -*.woff -*.woff2 -*.xcf -*.xlsx -*.zkey -release-artifacts -EOF -); - -echo Current directory: `pwd` - -codespell -I "${job_dir}"/dictionary.txt -S ${skip//$'\n'/,} +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/002-test/job.sh b/contrib/ci/jobs/002-test/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/test.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/003-docs/job.sh b/contrib/ci/jobs/003-docs/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/docs.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/100-build-debian-bookworm-amd64-gen/job.sh b/contrib/ci/jobs/100-build-debian-bookworm-amd64-gen/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/101-deb-package-debian-bookworm-amd64-gen/job.sh b/contrib/ci/jobs/101-deb-package-debian-bookworm-amd64-gen/job.sh @@ -1,23 +0,0 @@ -#!/bin/bash -set -exuo pipefail -# This file is in the public domain. -# Helper script to build the latest DEB packages in the container. - - -unset LD_LIBRARY_PATH - -# Install build-time dependencies. -# Update apt cache first -apt-get update -apt-get upgrade -y -mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - -export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -./bootstrap -dpkg-buildpackage -rfakeroot -b -uc -us - -ls -alh ../*.deb -mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment -mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ diff --git a/contrib/ci/jobs/101-deb-package-debian-bookworm-amd64-gen/version.sh b/contrib/ci/jobs/101-deb-package-debian-bookworm-amd64-gen/version.sh @@ -1,17 +0,0 @@ -#!/bin/sh -set -ex - -BRANCH=$(git name-rev --name-only HEAD) -if [ -z "${BRANCH}" ]; then - exit 1 -else - # "Unshallow" our checkout, but only our current branch, and exclude the submodules. - git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" - RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) - commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" - if [ "${commits}" = "0" ]; then - git describe --tag HEAD | sed -r 's/^v//' || exit 1 - else - echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) - fi -fi diff --git a/contrib/ci/jobs/102-upload-debian-bookworm-amd64-gen/job.sh b/contrib/ci/jobs/102-upload-debian-bookworm-amd64-gen/job.sh @@ -1,18 +1,2 @@ #!/bin/bash -set -exuo pipefail - -ARTIFACT_PATH="/artifacts/exchange/${CI_COMMIT_REF}/*.deb" -RELEASE_ARTIFACT_DIR="${RELEASE_ARTIFACT_DIR:-"$(dirname $0)/../../../../release-artifacts"}" - -if [[ -d "$RELEASE_ARTIFACT_DIR" ]]; then - rsync -vP $ARTIFACT_PATH $RELEASE_ARTIFACT_DIR -else - RSYNC_HOST=${RSYNC_HOST:-"taler.host.internal"} - RSYNC_PORT=${RSYNC_PORT:-424242} - RSYNC_PATH=${RSYNC_PATH:-"incoming_packages/bookworm-taler-ci/"} - RSYNC_DEST=${RSYNC_DEST:-"rsync://${RSYNC_HOST}/${RSYNC_PATH}"} - - rsync -vP \ - --port ${RSYNC_PORT} \ - ${ARTIFACT_PATH} ${RSYNC_DEST} -fi; +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/105-build-debian-bookworm-arm64-gen/job.sh b/contrib/ci/jobs/105-build-debian-bookworm-arm64-gen/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/106-deb-package-debian-bookworm-arm64-gen/job.sh b/contrib/ci/jobs/106-deb-package-debian-bookworm-arm64-gen/job.sh @@ -1,23 +1,2 @@ #!/bin/bash -set -exuo pipefail -# This file is in the public domain. -# Helper script to build the latest DEB packages in the container. - - -unset LD_LIBRARY_PATH - -# Install build-time dependencies. -# Update apt cache first -apt-get update -apt-get upgrade -y -mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - -export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -./bootstrap -dpkg-buildpackage -rfakeroot -b -uc -us - -ls -alh ../*.deb -mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment -mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/106-deb-package-debian-bookworm-arm64-gen/version.sh b/contrib/ci/jobs/106-deb-package-debian-bookworm-arm64-gen/version.sh @@ -1,17 +0,0 @@ -#!/bin/sh -set -ex - -BRANCH=$(git name-rev --name-only HEAD) -if [ -z "${BRANCH}" ]; then - exit 1 -else - # "Unshallow" our checkout, but only our current branch, and exclude the submodules. - git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" - RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) - commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" - if [ "${commits}" = "0" ]; then - git describe --tag HEAD | sed -r 's/^v//' || exit 1 - else - echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) - fi -fi diff --git a/contrib/ci/jobs/107-upload-debian-bookworm-arm64-gen/job.sh b/contrib/ci/jobs/107-upload-debian-bookworm-arm64-gen/job.sh @@ -1,18 +1,2 @@ #!/bin/bash -set -exuo pipefail - -ARTIFACT_PATH="/artifacts/exchange/${CI_COMMIT_REF}/*.deb" -RELEASE_ARTIFACT_DIR="${RELEASE_ARTIFACT_DIR:-"$(dirname $0)/../../../../release-artifacts"}" - -if [[ -d "$RELEASE_ARTIFACT_DIR" ]]; then - rsync -vP $ARTIFACT_PATH $RELEASE_ARTIFACT_DIR -else - RSYNC_HOST=${RSYNC_HOST:-"taler.host.internal"} - RSYNC_PORT=${RSYNC_PORT:-424242} - RSYNC_PATH=${RSYNC_PATH:-"incoming_packages/bookworm-taler-ci/"} - RSYNC_DEST=${RSYNC_DEST:-"rsync://${RSYNC_HOST}/${RSYNC_PATH}"} - - rsync -vP \ - --port ${RSYNC_PORT} \ - ${ARTIFACT_PATH} ${RSYNC_DEST} -fi; +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/110-build-debian-trixie-amd64-gen/job.sh b/contrib/ci/jobs/110-build-debian-trixie-amd64-gen/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-gen/job.sh b/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-gen/job.sh @@ -1,23 +1,2 @@ #!/bin/bash -set -exuo pipefail -# This file is in the public domain. -# Helper script to build the latest DEB packages in the container. - - -unset LD_LIBRARY_PATH - -# Install build-time dependencies. -# Update apt cache first -apt-get update -apt-get upgrade -y -mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - -export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -./bootstrap -dpkg-buildpackage -rfakeroot -b -uc -us - -ls -alh ../*.deb -mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment -mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-gen/version.sh b/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-gen/version.sh @@ -1,17 +0,0 @@ -#!/bin/sh -set -ex - -BRANCH=$(git name-rev --name-only HEAD) -if [ -z "${BRANCH}" ]; then - exit 1 -else - # "Unshallow" our checkout, but only our current branch, and exclude the submodules. - git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" - RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) - commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" - if [ "${commits}" = "0" ]; then - git describe --tag HEAD | sed -r 's/^v//' || exit 1 - else - echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) - fi -fi diff --git a/contrib/ci/jobs/112-upload-debian-trixie-amd64-gen/job.sh b/contrib/ci/jobs/112-upload-debian-trixie-amd64-gen/job.sh @@ -1,18 +1,2 @@ #!/bin/bash -set -exuo pipefail - -ARTIFACT_PATH="/artifacts/exchange/${CI_COMMIT_REF}/*.deb" -RELEASE_ARTIFACT_DIR="${RELEASE_ARTIFACT_DIR:-"$(dirname $0)/../../../../release-artifacts"}" - -if [[ -d "$RELEASE_ARTIFACT_DIR" ]]; then - rsync -vP $ARTIFACT_PATH $RELEASE_ARTIFACT_DIR -else - RSYNC_HOST=${RSYNC_HOST:-"taler.host.internal"} - RSYNC_PORT=${RSYNC_PORT:-424242} - RSYNC_PATH=${RSYNC_PATH:-"incoming_packages/trixie-taler-ci/"} - RSYNC_DEST=${RSYNC_DEST:-"rsync://${RSYNC_HOST}/${RSYNC_PATH}"} - - rsync -vP \ - --port ${RSYNC_PORT} \ - ${ARTIFACT_PATH} ${RSYNC_DEST} -fi; +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/115-build-debian-trixie-arm64-gen/job.sh b/contrib/ci/jobs/115-build-debian-trixie-arm64-gen/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/116-deb-package-debian-trixie-arm64-gen/job.sh b/contrib/ci/jobs/116-deb-package-debian-trixie-arm64-gen/job.sh @@ -1,23 +1,2 @@ #!/bin/bash -set -exuo pipefail -# This file is in the public domain. -# Helper script to build the latest DEB packages in the container. - - -unset LD_LIBRARY_PATH - -# Install build-time dependencies. -# Update apt cache first -apt-get update -apt-get upgrade -y -mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - -export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -./bootstrap -dpkg-buildpackage -rfakeroot -b -uc -us - -ls -alh ../*.deb -mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment -mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/116-deb-package-debian-trixie-arm64-gen/version.sh b/contrib/ci/jobs/116-deb-package-debian-trixie-arm64-gen/version.sh @@ -1,17 +0,0 @@ -#!/bin/sh -set -ex - -BRANCH=$(git name-rev --name-only HEAD) -if [ -z "${BRANCH}" ]; then - exit 1 -else - # "Unshallow" our checkout, but only our current branch, and exclude the submodules. - git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" - RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) - commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" - if [ "${commits}" = "0" ]; then - git describe --tag HEAD | sed -r 's/^v//' || exit 1 - else - echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) - fi -fi diff --git a/contrib/ci/jobs/117-upload-debian-trixie-arm64-gen/job.sh b/contrib/ci/jobs/117-upload-debian-trixie-arm64-gen/job.sh @@ -1,18 +1,2 @@ #!/bin/bash -set -exuo pipefail - -ARTIFACT_PATH="/artifacts/exchange/${CI_COMMIT_REF}/*.deb" -RELEASE_ARTIFACT_DIR="${RELEASE_ARTIFACT_DIR:-"$(dirname $0)/../../../../release-artifacts"}" - -if [[ -d "$RELEASE_ARTIFACT_DIR" ]]; then - rsync -vP $ARTIFACT_PATH $RELEASE_ARTIFACT_DIR -else - RSYNC_HOST=${RSYNC_HOST:-"taler.host.internal"} - RSYNC_PORT=${RSYNC_PORT:-424242} - RSYNC_PATH=${RSYNC_PATH:-"incoming_packages/trixie-taler-ci/"} - RSYNC_DEST=${RSYNC_DEST:-"rsync://${RSYNC_HOST}/${RSYNC_PATH}"} - - rsync -vP \ - --port ${RSYNC_PORT} \ - ${ARTIFACT_PATH} ${RSYNC_DEST} -fi; +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/120-build-debian-unstable-amd64-gen/job.sh b/contrib/ci/jobs/120-build-debian-unstable-amd64-gen/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/121-deb-package-debian-unstable-amd64-gen/job.sh b/contrib/ci/jobs/121-deb-package-debian-unstable-amd64-gen/job.sh @@ -1,23 +1,2 @@ #!/bin/bash -set -exuo pipefail -# This file is in the public domain. -# Helper script to build the latest DEB packages in the container. - - -unset LD_LIBRARY_PATH - -# Install build-time dependencies. -# Update apt cache first -apt-get update -apt-get upgrade -y -mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - -export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -./bootstrap -dpkg-buildpackage -rfakeroot -b -uc -us - -ls -alh ../*.deb -mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment -mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/121-deb-package-debian-unstable-amd64-gen/version.sh b/contrib/ci/jobs/121-deb-package-debian-unstable-amd64-gen/version.sh @@ -1,17 +0,0 @@ -#!/bin/sh -set -ex - -BRANCH=$(git name-rev --name-only HEAD) -if [ -z "${BRANCH}" ]; then - exit 1 -else - # "Unshallow" our checkout, but only our current branch, and exclude the submodules. - git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" - RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) - commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" - if [ "${commits}" = "0" ]; then - git describe --tag HEAD | sed -r 's/^v//' || exit 1 - else - echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) - fi -fi diff --git a/contrib/ci/jobs/122-upload-debian-unstable-amd64-gen/job.sh b/contrib/ci/jobs/122-upload-debian-unstable-amd64-gen/job.sh @@ -1,18 +1,2 @@ #!/bin/bash -set -exuo pipefail - -ARTIFACT_PATH="/artifacts/exchange/${CI_COMMIT_REF}/*.deb" -RELEASE_ARTIFACT_DIR="${RELEASE_ARTIFACT_DIR:-"$(dirname $0)/../../../../release-artifacts"}" - -if [[ -d "$RELEASE_ARTIFACT_DIR" ]]; then - rsync -vP $ARTIFACT_PATH $RELEASE_ARTIFACT_DIR -else - RSYNC_HOST=${RSYNC_HOST:-"taler.host.internal"} - RSYNC_PORT=${RSYNC_PORT:-424242} - RSYNC_PATH=${RSYNC_PATH:-"incoming_packages/unstable-taler-ci/"} - RSYNC_DEST=${RSYNC_DEST:-"rsync://${RSYNC_HOST}/${RSYNC_PATH}"} - - rsync -vP \ - --port ${RSYNC_PORT} \ - ${ARTIFACT_PATH} ${RSYNC_DEST} -fi; +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/125-build-debian-unstable-arm64-gen/job.sh b/contrib/ci/jobs/125-build-debian-unstable-arm64-gen/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/126-deb-package-debian-unstable-arm64-gen/job.sh b/contrib/ci/jobs/126-deb-package-debian-unstable-arm64-gen/job.sh @@ -1,23 +1,2 @@ #!/bin/bash -set -exuo pipefail -# This file is in the public domain. -# Helper script to build the latest DEB packages in the container. - - -unset LD_LIBRARY_PATH - -# Install build-time dependencies. -# Update apt cache first -apt-get update -apt-get upgrade -y -mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - -export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -./bootstrap -dpkg-buildpackage -rfakeroot -b -uc -us - -ls -alh ../*.deb -mkdir -p /artifacts/exchange/${CI_COMMIT_REF} # Variable comes from CI environment -mv ../*.deb /artifacts/exchange/${CI_COMMIT_REF}/ +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/jobs/126-deb-package-debian-unstable-arm64-gen/version.sh b/contrib/ci/jobs/126-deb-package-debian-unstable-arm64-gen/version.sh @@ -1,17 +0,0 @@ -#!/bin/sh -set -ex - -BRANCH=$(git name-rev --name-only HEAD) -if [ -z "${BRANCH}" ]; then - exit 1 -else - # "Unshallow" our checkout, but only our current branch, and exclude the submodules. - git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" - RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) - commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" - if [ "${commits}" = "0" ]; then - git describe --tag HEAD | sed -r 's/^v//' || exit 1 - else - echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) - fi -fi diff --git a/contrib/ci/jobs/127-upload-debian-unstable-arm64-gen/job.sh b/contrib/ci/jobs/127-upload-debian-unstable-arm64-gen/job.sh @@ -1,18 +1,2 @@ #!/bin/bash -set -exuo pipefail - -ARTIFACT_PATH="/artifacts/exchange/${CI_COMMIT_REF}/*.deb" -RELEASE_ARTIFACT_DIR="${RELEASE_ARTIFACT_DIR:-"$(dirname $0)/../../../../release-artifacts"}" - -if [[ -d "$RELEASE_ARTIFACT_DIR" ]]; then - rsync -vP $ARTIFACT_PATH $RELEASE_ARTIFACT_DIR -else - RSYNC_HOST=${RSYNC_HOST:-"taler.host.internal"} - RSYNC_PORT=${RSYNC_PORT:-424242} - RSYNC_PATH=${RSYNC_PATH:-"incoming_packages/unstable-taler-ci/"} - RSYNC_DEST=${RSYNC_DEST:-"rsync://${RSYNC_HOST}/${RSYNC_PATH}"} - - rsync -vP \ - --port ${RSYNC_PORT} \ - ${ARTIFACT_PATH} ${RSYNC_DEST} -fi; +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/targets/debian/build/job.sh b/contrib/ci/targets/debian/build/job.sh @@ -1,6 +1,2 @@ #!/bin/bash -set -exuo pipefail - -job_dir=$(dirname "${BASH_SOURCE[0]}") - -"${job_dir}"/build.sh +exec ./contrib/ci/debian-package-job.sh diff --git a/contrib/ci/version.sh b/contrib/ci/version.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -ex +# This file is in the public domain. +# Determines the current version of our code. +# Shared between various jobs. + +BRANCH=$(git name-rev --name-only HEAD) +if [ -z "${BRANCH}" ]; then + exit 1 +else + # "Unshallow" our checkout, but only our current branch, and exclude the submodules. + git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" + RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1) + commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" + if [ "${commits}" = "0" ]; then + git describe --tag HEAD | sed -r 's/^v//' || exit 1 + else + echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) + fi +fi diff --git a/debian/taler-auditor.taler-helper-auditor-aggregation.service b/debian/taler-auditor.taler-helper-auditor-aggregation.service @@ -0,0 +1,15 @@ +[Unit] +Description=GNU Taler auditor helper checking aggregations +After=postgres.service + +[Service] +User=taler-auditor-httpd +Type=simple +Restart=always +RestartSec=1s +RestartPreventExitStatus=9 +ExecStart=/usr/bin/taler-helper-auditor-aggregation -c /etc/taler/taler.conf -L INFO +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +RuntimeMaxSec=3600s diff --git a/debian/taler-auditor.taler-helper-auditor-coins.service b/debian/taler-auditor.taler-helper-auditor-coins.service @@ -0,0 +1,15 @@ +[Unit] +Description=GNU Taler auditor helper checking coin histories +After=postgres.service + +[Service] +User=taler-auditor-httpd +Type=simple +Restart=always +RestartSec=1s +RestartPreventExitStatus=9 +ExecStart=/usr/bin/taler-helper-auditor-coins -c /etc/taler/taler.conf -L INFO +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +RuntimeMaxSec=3600s diff --git a/debian/taler-auditor.taler-helper-auditor-deposits.service b/debian/taler-auditor.taler-helper-auditor-deposits.service @@ -1,5 +1,5 @@ [Unit] -Description=GNU Taler auditor helper reporting confirmation deposits +Description=GNU Taler auditor helper checking confirmation deposits After=postgres.service [Service] diff --git a/debian/taler-auditor.taler-helper-auditor-purses.service b/debian/taler-auditor.taler-helper-auditor-purses.service @@ -0,0 +1,15 @@ +[Unit] +Description=GNU Taler auditor helper checking purses +After=postgres.service + +[Service] +User=taler-auditor-httpd +Type=simple +Restart=always +RestartSec=1s +RestartPreventExitStatus=9 +ExecStart=/usr/bin/taler-helper-auditor-purses -c /etc/taler/taler.conf -L INFO +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +RuntimeMaxSec=3600s diff --git a/debian/taler-auditor.taler-helper-auditor-reserves.service b/debian/taler-auditor.taler-helper-auditor-reserves.service @@ -0,0 +1,15 @@ +[Unit] +Description=GNU Taler auditor helper checking reserves +After=postgres.service + +[Service] +User=taler-auditor-httpd +Type=simple +Restart=always +RestartSec=1s +RestartPreventExitStatus=9 +ExecStart=/usr/bin/taler-helper-auditor-reserves -c /etc/taler/taler.conf -L INFO +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +RuntimeMaxSec=3600s diff --git a/debian/taler-auditor.taler-helper-auditor-wire-credit.service b/debian/taler-auditor.taler-helper-auditor-wire-credit.service @@ -0,0 +1,15 @@ +[Unit] +Description=GNU Taler auditor helper checking for missing wire credit transfers +After=postgres.service + +[Service] +User=taler-auditor-httpd +Type=simple +Restart=always +RestartSec=1s +RestartPreventExitStatus=9 +ExecStart=/usr/bin/taler-helper-auditor-wire-credit -c /etc/taler/taler.conf -L INFO +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +RuntimeMaxSec=3600s diff --git a/debian/taler-auditor.taler-helper-auditor-wire-debit.service b/debian/taler-auditor.taler-helper-auditor-wire-debit.service @@ -0,0 +1,15 @@ +[Unit] +Description=GNU Taler auditor helper checking outgoing wire debit operations +After=postgres.service + +[Service] +User=taler-auditor-httpd +Type=simple +Restart=always +RestartSec=1s +RestartPreventExitStatus=9 +ExecStart=/usr/bin/taler-helper-auditor-wire-debit -c /etc/taler/taler.conf -L INFO +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=full +RuntimeMaxSec=3600s diff --git a/debian/taler-exchange.install b/debian/taler-exchange.install @@ -6,6 +6,7 @@ usr/bin/taler-exchange-httpd usr/bin/taler-exchange-kyc-aml-pep-trigger.sh usr/bin/taler-exchange-kyc-oauth2-challenger.sh usr/bin/taler-exchange-kyc-kycaid-converter.sh +usr/bin/taler-exchange-helper-measure-test-form usr/bin/taler-exchange-kyc-persona-converter.sh usr/bin/taler-exchange-router usr/bin/taler-exchange-secmod-cs diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c @@ -101,17 +101,6 @@ TALER_ARL_do_abort (void) } -void -TALER_ARL_report (json_t *array, - json_t *object) -{ - GNUNET_assert (NULL != object); - GNUNET_assert (0 == - json_array_append_new (array, - object)); -} - - /** * Function called with the results of iterate_denomination_info(), * or directly (!). Used to check and add the respective denomination diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h @@ -132,17 +132,6 @@ extern struct GNUNET_TIME_Absolute start_time; /** - * Add @a object to the report @a array. Fail hard if this fails. - * - * @param array report array to append @a object to - * @param object object to append, should be check that it is not NULL - */ -void -TALER_ARL_report (json_t *array, - json_t *object); - - -/** * Obtain information about a @a denom_pub. * * @param dh hash of the denomination public key to look up diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c @@ -159,8 +159,6 @@ report_amount_arithmetic_inconsistency ( { struct TALER_Amount delta; struct TALER_Amount *target; - enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_AmountArithmeticInconsistency aai; if (0 < TALER_amount_cmp (exchange, auditor)) @@ -178,33 +176,26 @@ report_amount_arithmetic_inconsistency ( auditor, exchange); } - aai.profitable = profitable; - aai.operation = (char *) operation; - aai.exchange_amount = *exchange; - aai.auditor_amount = *auditor; - - qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( - TALER_ARL_adb->cls, - &aai); - if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - } + enum GNUNET_DB_QueryStatus qs; + struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = { + .profitable = profitable, + .operation = (char *) operation, + .exchange_amount = *exchange, + .auditor_amount = *auditor + }; + qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( + TALER_ARL_adb->cls, + &aai); - TALER_ARL_report (report_amount_arithmetic_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_uint64 ("rowid", - rowid), - TALER_JSON_pack_amount ("exchange", - exchange), - TALER_JSON_pack_amount ("auditor", - auditor), - GNUNET_JSON_pack_int64 ("profitable", - profitable))); + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling + } + } if (0 != profitable) { target = (1 == profitable) @@ -240,8 +231,6 @@ report_coin_arithmetic_inconsistency ( { struct TALER_Amount delta; struct TALER_Amount *target; - enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_CoinInconsistency ci; if (0 < TALER_amount_cmp (exchange, auditor)) @@ -260,33 +249,26 @@ report_coin_arithmetic_inconsistency ( exchange); } - ci.operation = (char *) operation; - ci.auditor_amount = *auditor; - ci.exchange_amount = *exchange; - ci.profitable = profitable; - ci.coin_pub = coin_pub->eddsa_pub; + { + enum GNUNET_DB_QueryStatus qs; + struct TALER_AUDITORDB_CoinInconsistency ci = { + .operation = (char *) operation, + .auditor_amount = *auditor, + .exchange_amount = *exchange, + .profitable = profitable, + .coin_pub = coin_pub->eddsa_pub + }; - qs = TALER_ARL_adb->insert_coin_inconsistency ( - TALER_ARL_adb->cls, - &ci); + qs = TALER_ARL_adb->insert_coin_inconsistency ( + TALER_ARL_adb->cls, + &ci); - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling + } } - - TALER_ARL_report (report_coin_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_data_auto ("coin_pub", - coin_pub), - TALER_JSON_pack_amount ("exchange", - exchange), - TALER_JSON_pack_amount ("auditor", - auditor), - GNUNET_JSON_pack_int64 ("profitable", - profitable))); if (0 != profitable) { target = (1 == profitable) @@ -312,11 +294,11 @@ report_row_inconsistency (const char *table, const char *diagnostic) { enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_RowInconsistency ri; - - ri.diagnostic = (char *) diagnostic; - ri.row_table = (char *) table; - ri.row_id = rowid; + struct TALER_AUDITORDB_RowInconsistency ri = { + .diagnostic = (char *) diagnostic, + .row_table = (char *) table, + .row_id = rowid + }; qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, @@ -325,16 +307,8 @@ report_row_inconsistency (const char *table, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - table), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_string ("diagnostic", - diagnostic))); } @@ -467,7 +441,6 @@ check_transaction_history_for_deposit ( struct TALER_Amount merchant_loss; const struct TALER_Amount *deposit_fee; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_RowInconsistency ri; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking transaction history of coin %s\n", @@ -502,11 +475,12 @@ check_transaction_history_for_deposit ( /* check wire and h_wire are consistent */ if (NULL != deposited) { - ri.row_id = tl->serial_id; - char *diagnostic = - "multiple deposits of the same coin into the same contract detected"; - ri.diagnostic = diagnostic; - ri.row_table = "deposits"; + struct TALER_AUDITORDB_RowInconsistency ri = { + .row_id = tl->serial_id, + .diagnostic = + "multiple deposits of the same coin into the same contract detected", + .row_table = "deposits" + }; qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, @@ -515,16 +489,8 @@ check_transaction_history_for_deposit ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - "deposits"), - GNUNET_JSON_pack_uint64 ("row", - tl->serial_id), - GNUNET_JSON_pack_string ("diagnostic", - diagnostic))); } deposited = &tl->details.deposit->amount_with_fee; /* according to exchange*/ fee_claimed = &tl->details.deposit->deposit_fee; /* Fee according to exchange DB */ @@ -850,7 +816,6 @@ wire_transfer_information_cb ( enum GNUNET_DB_QueryStatus qs; struct TALER_PaytoHashP hpt; uint64_t etag_out; - struct TALER_AUDITORDB_BadSigLosses bsl; TALER_payto_hash (account_pay_uri, &hpt); @@ -925,30 +890,21 @@ wire_transfer_information_cb ( TALER_test_coin_valid (&coin, denom_pub)) { - bsl.row_id = rowid; - bsl.operation = "wire"; - bsl.loss = *coin_value; - bsl.operation_specific_pub = coin.coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "wire", + .loss = *coin_value, + .operation_specific_pub = coin.coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); - if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "wire"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - coin_value), - GNUNET_JSON_pack_data_auto ("coin_pub", - &coin.coin_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, coin_value); @@ -1136,12 +1092,11 @@ get_wire_fee (struct AggregationContext *ac, >, wfi->start_date)) { - struct TALER_AUDITORDB_FeeTimeInconsistency ftib; - char *diagnosticb = "start date before previous end date"; - ftib.diagnostic = diagnosticb; - ftib.time = wfi->start_date.abs_time; - ftib.type = (char *) method; - + struct TALER_AUDITORDB_FeeTimeInconsistency ftib = { + .diagnostic = "start date before previous end date", + .time = wfi->start_date.abs_time, + .type = (char *) method + }; qs = TALER_ARL_adb->insert_fee_time_inconsistency ( TALER_ARL_adb->cls, @@ -1150,28 +1105,19 @@ get_wire_fee (struct AggregationContext *ac, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_fee_time_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("type", - method), - GNUNET_JSON_pack_string ("diagnostic", - diagnosticb), - TALER_JSON_pack_time_abs_human ("time", - wfi->start_date.abs_time - ))); } if ((NULL != wfi->next) && GNUNET_TIME_timestamp_cmp (wfi->next->start_date, >=, wfi->end_date)) { - struct TALER_AUDITORDB_FeeTimeInconsistency ftia; - char *diagnostica = "end date date after next start date"; - ftia.diagnostic = diagnostica; - ftia.time = wfi->end_date.abs_time; - ftia.type = (char *) method; + struct TALER_AUDITORDB_FeeTimeInconsistency ftia = { + .diagnostic = "end date date after next start date", + .time = wfi->end_date.abs_time, + .type = (char *) method + }; qs = TALER_ARL_adb->insert_fee_time_inconsistency ( TALER_ARL_adb->cls, @@ -1180,17 +1126,8 @@ get_wire_fee (struct AggregationContext *ac, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_fee_time_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("type", - method), - GNUNET_JSON_pack_string ("diagnostic", - diagnostica), - TALER_JSON_pack_time_abs_human ("time", - wfi->end_date.abs_time)) - ); } return &wfi->fees.wire; } @@ -1222,7 +1159,6 @@ check_wire_out_cb (void *cls, struct TALER_Amount exchange_gain; enum GNUNET_DB_QueryStatus qs; char *method; - struct TALER_AUDITORDB_WireOutInconsistency woi; /* should be monotonically increasing */ GNUNET_assert (rowid >= @@ -1346,32 +1282,25 @@ check_wire_out_cb (void *cls, &total_wire_out_delta_minus, &delta); } - woi.row_id = rowid; - woi.destination_account = (char *) payto_uri; - woi.expected = final_amount; - woi.claimed = *amount; - - qs = TALER_ARL_adb->insert_wire_out_inconsistency ( - TALER_ARL_adb->cls, - &woi); - if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = rowid, + .destination_account = (char *) payto_uri, + .expected = final_amount, + .claimed = *amount + }; + + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); + + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling + } } - - TALER_ARL_report (report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("destination_account", - payto_uri), - GNUNET_JSON_pack_uint64 ("rowid", - rowid), - TALER_JSON_pack_amount ("expected", - &final_amount), - TALER_JSON_pack_amount ("claimed", - amount))); - if (TALER_ARL_do_abort ()) - return GNUNET_SYSERR; return GNUNET_OK; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c @@ -280,13 +280,14 @@ report_emergency_by_amount ( TALER_amount2s (loss)); enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_Emergency emergency; - emergency.denom_loss = *loss; - emergency.denompub_h = *&issue->denom_hash; - emergency.denom_risk = *risk; - emergency.deposit_start = *&issue->start.abs_time; - emergency.deposit_end = *&issue->expire_deposit.abs_time; - emergency.value = *&issue->value; + struct TALER_AUDITORDB_Emergency emergency = { + .denom_loss = *loss, + .denompub_h = *&issue->denom_hash, + .denom_risk = *risk, + .deposit_start = *&issue->start.abs_time, + .deposit_end = *&issue->expire_deposit.abs_time, + .value = *&issue->value + }; qs = TALER_ARL_adb->insert_emergency ( TALER_ARL_adb->cls, @@ -295,23 +296,8 @@ report_emergency_by_amount ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report ( - report_emergencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("denompub_hash", - &issue->denom_hash), - TALER_JSON_pack_amount ("denom_risk", - risk), - TALER_JSON_pack_amount ("denom_loss", - loss), - TALER_JSON_pack_time_abs_human ("start", - issue->start.abs_time), - TALER_JSON_pack_time_abs_human ("deposit_end", - issue->expire_deposit.abs_time), - TALER_JSON_pack_amount ("value", - &issue->value))); TALER_ARL_amount_add (&reported_emergency_risk_by_amount, &reported_emergency_risk_by_amount, risk); @@ -343,13 +329,14 @@ report_emergency_by_count ( const struct TALER_Amount *risk) { enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_EmergenciesByCount emergenciesByCount; - emergenciesByCount.denompub_h = issue->denom_hash; - emergenciesByCount.num_issued = num_issued; - emergenciesByCount.num_known = num_known; - emergenciesByCount.start = issue->start.abs_time; - emergenciesByCount.deposit_end = issue->expire_deposit.abs_time; - emergenciesByCount.value = issue->value; + struct TALER_AUDITORDB_EmergenciesByCount emergenciesByCount = { + .denompub_h = issue->denom_hash, + .num_issued = num_issued, + .num_known = num_known, + .start = issue->start.abs_time, + .deposit_end = issue->expire_deposit.abs_time, + .value = issue->value + }; qs = TALER_ARL_adb->insert_emergency_by_count ( TALER_ARL_adb->cls, @@ -358,26 +345,8 @@ report_emergency_by_count ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - - TALER_ARL_report ( - report_emergencies_by_count, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("denompub_h", &issue->denom_hash), - GNUNET_JSON_pack_uint64 ("num_issued", - num_issued), - GNUNET_JSON_pack_uint64 ("num_known", - num_known), - TALER_JSON_pack_amount ("denom_risk", - risk), - TALER_JSON_pack_time_abs_human ("start", issue->start.abs_time), - TALER_JSON_pack_time_abs_human ("deposit_end", - issue->expire_deposit.abs_time), - TALER_JSON_pack_amount ("value", - &issue->value))); - - TALER_ARL_amount_add (&reported_emergency_risk_by_count, &reported_emergency_risk_by_count, risk); @@ -414,8 +383,6 @@ report_amount_arithmetic_inconsistency ( { struct TALER_Amount delta; struct TALER_Amount *target; - enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_AmountArithmeticInconsistency aai; if (0 < TALER_amount_cmp (exchange, auditor)) @@ -434,33 +401,24 @@ report_amount_arithmetic_inconsistency ( exchange); } - aai.profitable = profitable; - aai.operation = (char *) operation; - aai.exchange_amount = *exchange; - aai.auditor_amount = *auditor; - - qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( - TALER_ARL_adb->cls, - &aai); - - if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - } - + struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = { + .profitable = profitable, + .operation = (char *) operation, + .exchange_amount = *exchange, + .auditor_amount = *auditor + }; + enum GNUNET_DB_QueryStatus qs; - TALER_ARL_report (report_amount_arithmetic_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_uint64 ("rowid", - rowid), - TALER_JSON_pack_amount ("exchange", - exchange), - TALER_JSON_pack_amount ("auditor", - auditor), - GNUNET_JSON_pack_int64 ("profitable", - profitable))); + qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( + TALER_ARL_adb->cls, + &aai); + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! + } + } if (0 != profitable) { target = (1 == profitable) @@ -487,30 +445,20 @@ report_row_inconsistency (const char *table, { enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_RowInconsistency ri; - ri.row_table = (char *) table; - ri.row_id = rowid; - ri.diagnostic = (char *) diagnostic; - + struct TALER_AUDITORDB_RowInconsistency ri = { + .row_table = (char *) table, + .row_id = rowid, + .diagnostic = (char *) diagnostic + }; qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, &ri); - if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - table), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_string ("diagnostic", - diagnostic))); } @@ -1203,7 +1151,7 @@ check_known_coin ( { struct TALER_CoinPublicInfo ci; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; + if (NULL == get_cached_history (coin_pub)) { qs = check_coin_history (coin_pub, @@ -1233,10 +1181,11 @@ check_known_coin ( TALER_test_coin_valid (&ci, denom_pub)) { - - bsl.operation = (char *) operation; - bsl.loss = *loss_potential; - bsl.operation_specific_pub = coin_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = (char *) operation, + .loss = *loss_potential, + .operation_specific_pub = coin_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -1244,18 +1193,8 @@ check_known_coin ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - loss_potential), - GNUNET_JSON_pack_data_auto ("coin_pub", - coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), loss_potential); @@ -1358,7 +1297,6 @@ refresh_session_cb (void *cls, struct DenominationSummary *dso; struct TALER_Amount amount_without_fee; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; (void) noreveal_index; GNUNET_assert (rowid >= @@ -1409,30 +1347,21 @@ refresh_session_cb (void *cls, coin_pub, coin_sig)) { - GNUNET_break_op (0); - - bsl.operation = "melt"; - bsl.loss = *amount_with_fee; - bsl.operation_specific_pub = coin_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = "melt", + .loss = *amount_with_fee, + .operation_specific_pub = coin_pub->eddsa_pub + }; + GNUNET_break_op (0); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "melt"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount_with_fee), - GNUNET_JSON_pack_data_auto ("coin_pub", - coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), amount_with_fee); @@ -1450,7 +1379,6 @@ refresh_session_cb (void *cls, .rowid = rowid, .err = GNUNET_OK }; - struct TALER_AUDITORDB_RefreshesHanging rh; qs = TALER_ARL_edb->get_refresh_reveal (TALER_ARL_edb->cls, rc, @@ -1468,27 +1396,20 @@ refresh_session_cb (void *cls, /* This can legitimately happen if reveal was not yet called or only with invalid data, even if the exchange is correctly operating. We still report it. */ - rh.row_id = rowid; - rh.amount = *amount_with_fee; - rh.coin_pub = coin_pub->eddsa_pub; + struct TALER_AUDITORDB_RefreshesHanging rh = { + .row_id = rowid, + .amount = *amount_with_fee, + .coin_pub = coin_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_refreshes_hanging ( TALER_ARL_adb->cls, &rh); - if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_refreshes_hanging, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount", - amount_with_fee), - GNUNET_JSON_pack_data_auto ("coin_pub", - coin_pub))); TALER_ARL_amount_add (&total_refresh_hanging, &total_refresh_hanging, amount_with_fee); @@ -1656,7 +1577,6 @@ deposit_cb (void *cls, const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue; struct DenominationSummary *ds; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; (void) done; (void) exchange_timestamp; @@ -1734,14 +1654,11 @@ deposit_cb (void *cls, &deposit->coin.coin_pub, &deposit->csig)) { - bsl.operation = "deposit"; - bsl.loss = deposit->amount_with_fee; - bsl.operation_specific_pub = deposit->coin.coin_pub.eddsa_pub; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--operation %s\n", bsl.operation); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--loss %s\n", - TALER_amount_to_string (&bsl.loss)); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--operation_specific_pub %s\n", - TALER_B2S (&bsl.operation_specific_pub)); + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = "deposit", + .loss = deposit->amount_with_fee, + .operation_specific_pub = deposit->coin.coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -1750,19 +1667,8 @@ deposit_cb (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "deposit"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - &deposit->amount_with_fee), - GNUNET_JSON_pack_data_auto ("coin_pub", - &deposit->coin.coin_pub))) - ; TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), &deposit->amount_with_fee); @@ -1839,7 +1745,6 @@ refund_cb (void *cls, struct DenominationSummary *ds; struct TALER_Amount amount_without_fee; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; GNUNET_assert (rowid >= TALER_ARL_USE_PP (coins_refund_serial_id)); /* should be monotonically increasing */ TALER_ARL_USE_PP (coins_refund_serial_id) = rowid + 1; @@ -1871,29 +1776,20 @@ refund_cb (void *cls, merchant_pub, merchant_sig)) { - bsl.operation = "refund"; - bsl.loss = *amount_with_fee; - bsl.operation_specific_pub = coin_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = "refund", + .loss = *amount_with_fee, + .operation_specific_pub = coin_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); - if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "refund"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount_with_fee), - GNUNET_JSON_pack_data_auto ("coin_pub", - coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), amount_with_fee); @@ -2122,8 +2018,6 @@ check_recoup (struct CoinContext *cc, struct DenominationSummary *ds; enum GNUNET_DB_QueryStatus qs; const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue; - struct TALER_AUDITORDB_BadSigLosses bsl; - struct TALER_AUDITORDB_BadSigLosses bsldnr; if (GNUNET_OK != TALER_wallet_recoup_verify (&coin->denom_pub_hash, @@ -2139,10 +2033,12 @@ check_recoup (struct CoinContext *cc, TALER_test_coin_valid (coin, denom_pub)) { - bsl.operation = (char *) operation; - bsl.loss = *amount; - // TODO: maybe adding the wrong pub hash - bsl.operation_specific_pub = coin->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = (char *) operation, + .loss = *amount, + // TODO: maybe adding the wrong pub + bsl.operation_specific_pub = coin->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -2151,18 +2047,8 @@ check_recoup (struct CoinContext *cc, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("coin_pub", - &coin->denom_pub_hash))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), amount); @@ -2211,10 +2097,12 @@ check_recoup (struct CoinContext *cc, { if (! ds->was_revoked) { - bsldnr.operation = (char *) operation; - bsldnr.loss = *amount; - // TODO: hint missing? - bsldnr.operation_specific_pub = coin->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsldnr = { + .operation = (char *) operation, + .loss = *amount, + // TODO: hint missing? + .operation_specific_pub = coin->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -2223,21 +2111,8 @@ check_recoup (struct CoinContext *cc, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - /* Woopsie, we allowed recoup on non-revoked denomination!? */ - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_string ("hint", - "denomination not revoked"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("coin_pub", - &coin->coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), amount); @@ -2281,7 +2156,6 @@ recoup_cb (void *cls, const union GNUNET_CRYPTO_BlindingSecretP *coin_blind) { struct CoinContext *cc = cls; - struct TALER_AUDITORDB_BadSigLosses bsl; enum GNUNET_DB_QueryStatus qs; GNUNET_assert (rowid >= TALER_ARL_USE_PP (coins_recoup_serial_id)); /* should be monotonically increasing */ @@ -2294,9 +2168,11 @@ recoup_cb (void *cls, &coin->coin_pub, coin_sig)) { - bsl.operation = "recoup"; - bsl.loss = *amount; - bsl.operation_specific_pub = coin->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = "recoup", + .loss = *amount, + .operation_specific_pub = coin->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -2305,18 +2181,8 @@ recoup_cb (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "recoup"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("coin_pub", - &coin->coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), amount); @@ -2366,7 +2232,6 @@ recoup_refresh_cb (void *cls, struct CoinContext *cc = cls; const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; (void) timestamp; (void) old_coin_pub; @@ -2422,9 +2287,11 @@ recoup_refresh_cb (void *cls, &coin->coin_pub, coin_sig)) { - bsl.operation = "recoup-refresh"; - bsl.loss = *amount; - bsl.operation_specific_pub = coin->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = "recoup-refresh", + .loss = *amount, + .operation_specific_pub = coin->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -2433,18 +2300,8 @@ recoup_refresh_cb (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "recoup-refresh"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("coin_pub", - &coin->coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), amount); @@ -2481,7 +2338,6 @@ check_denomination ( { enum GNUNET_DB_QueryStatus qs; struct TALER_AuditorSignatureP auditor_sig; - struct TALER_AUDITORDB_DenominationsWithoutSigs dws; (void) cls; (void) denom_pub; @@ -2519,10 +2375,12 @@ check_denomination ( &TALER_ARL_auditor_pub, &auditor_sig)) { - dws.denompub_h = issue->denom_hash; - dws.start_time = issue->start.abs_time; - dws.end_time = issue->expire_legal.abs_time; - dws.value = issue->value; + struct TALER_AUDITORDB_DenominationsWithoutSigs dws = { + .denompub_h = issue->denom_hash, + .start_time = issue->start.abs_time, + .end_time = issue->expire_legal.abs_time, + .value = issue->value + }; qs = TALER_ARL_adb->insert_denominations_without_sigs ( TALER_ARL_adb->cls, @@ -2531,19 +2389,8 @@ check_denomination ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_denominations_without_sigs, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("denomination", - &issue->denom_hash), - TALER_JSON_pack_amount ("value", - &issue->value), - TALER_JSON_pack_time_abs_human ("start_time", - issue->start.abs_time), - TALER_JSON_pack_time_abs_human ("end_time", - issue->expire_legal. - abs_time))); } } @@ -2579,7 +2426,6 @@ purse_deposit_cb ( struct TALER_DenominationHashP dh; const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue; struct DenominationSummary *ds; - struct TALER_AUDITORDB_BadSigLosses bsl; (void) flags; (void) auditor_balance; @@ -2625,9 +2471,11 @@ purse_deposit_cb ( &deposit->coin_pub, &deposit->coin_sig)) { - bsl.operation = "purse-deposit"; - bsl.loss = deposit->amount; - bsl.operation_specific_pub = deposit->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .operation = "purse-deposit", + .loss = deposit->amount, + .operation_specific_pub = deposit->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -2636,18 +2484,8 @@ purse_deposit_cb ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "purse-deposit"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - &deposit->amount), - GNUNET_JSON_pack_data_auto ("coin_pub", - &deposit->coin_pub))); TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss), &TALER_ARL_USE_AB (coin_irregular_loss), &deposit->amount); diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c @@ -204,19 +204,6 @@ test_dc (void *cls, return GNUNET_OK; /* all coins found, all good */ } - /* deposit confirmation missing! report! */ - TALER_ARL_report ( - report_deposit_confirmation_inconsistencies, - GNUNET_JSON_PACK ( - - TALER_JSON_pack_time_abs_human ("timestamp", - dc->exchange_timestamp.abs_time), - TALER_JSON_pack_amount ("amount", - &dc->total_without_fee), - GNUNET_JSON_pack_uint64 ("rowid", - serial_id), - GNUNET_JSON_pack_data_auto ("account", - &dc->h_wire))); // dcc->first_missed_coin_serial = GNUNET_MIN (dcc->first_missed_coin_serial, serial_id); dcc->missed_count++; TALER_ARL_amount_add (&dcc->missed_amount, diff --git a/src/auditor/taler-helper-auditor-purses.c b/src/auditor/taler-helper-auditor-purses.c @@ -157,7 +157,6 @@ report_amount_arithmetic_inconsistency ( { struct TALER_Amount delta; struct TALER_Amount *target; - struct TALER_AUDITORDB_AmountArithmeticInconsistency aai; enum GNUNET_DB_QueryStatus qs; if (0 < TALER_amount_cmp (exchange, @@ -176,32 +175,26 @@ report_amount_arithmetic_inconsistency ( auditor, exchange); } - aai.profitable = profitable; - aai.operation = (char *) operation; - aai.exchange_amount = *exchange; - aai.auditor_amount = *auditor; - qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( - TALER_ARL_adb->cls, - &aai); - - if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = { + .profitable = profitable, + .operation = (char *) operation, + .exchange_amount = *exchange, + .auditor_amount = *auditor + }; + + qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( + TALER_ARL_adb->cls, + &aai); + + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! + } } - TALER_ARL_report (report_amount_arithmetic_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_uint64 ("rowid", - rowid), - TALER_JSON_pack_amount ("exchange", - exchange), - TALER_JSON_pack_amount ("auditor", - auditor), - GNUNET_JSON_pack_int64 ("profitable", - profitable))); if (0 != profitable) { target = (1 == profitable) @@ -227,11 +220,11 @@ report_row_inconsistency (const char *table, const char *diagnostic) { enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_RowInconsistency ri; - - ri.diagnostic = (char *) diagnostic; - ri.row_table = (char *) table; - ri.row_id = rowid; + struct TALER_AUDITORDB_RowInconsistency ri = { + .diagnostic = (char *) diagnostic, + .row_table = (char *) table, + .row_id = rowid + }; qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, @@ -240,16 +233,8 @@ report_row_inconsistency (const char *table, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - table), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_string ("diagnostic", - diagnostic))); } @@ -523,7 +508,6 @@ handle_purse_requested ( struct PurseContext *pc = cls; struct PurseSummary *ps; struct GNUNET_HashCode key; - struct TALER_AUDITORDB_BadSigLosses bsl; enum GNUNET_DB_QueryStatus qs; TALER_ARL_USE_PP (purse_request_serial_id) = rowid; @@ -536,10 +520,12 @@ handle_purse_requested ( purse_pub, purse_sig)) { - bsl.row_id = rowid; - bsl.operation = "purse-request"; - bsl.loss = *target_amount; - bsl.operation_specific_pub = purse_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "purse-request", + .loss = *target_amount, + .operation_specific_pub = purse_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -548,18 +534,8 @@ handle_purse_requested ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "purse-reqeust"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - target_amount), - GNUNET_JSON_pack_data_auto ("key_pub", - purse_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, target_amount); @@ -620,7 +596,6 @@ handle_purse_deposits ( : deposit->exchange_base_url; struct TALER_DenominationHashP h_denom_pub; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; /* should be monotonically increasing */ GNUNET_assert (rowid >= TALER_ARL_USE_PP (purse_deposits_serial_id)); @@ -666,10 +641,12 @@ handle_purse_deposits ( &deposit->coin_pub, &deposit->coin_sig)) { - bsl.row_id = rowid; - bsl.operation = "purse-deposit"; - bsl.loss = deposit->amount; - bsl.operation_specific_pub = deposit->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "purse-deposit", + .loss = deposit->amount, + .operation_specific_pub = deposit->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -678,18 +655,8 @@ handle_purse_deposits ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "purse-deposit"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - &deposit->amount), - GNUNET_JSON_pack_data_auto ("key_pub", - &deposit->coin_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, &deposit->amount); @@ -756,7 +723,6 @@ handle_purse_merged ( { struct PurseContext *pc = cls; struct PurseSummary *ps; - struct TALER_AUDITORDB_BadSigLosses bsl; enum GNUNET_DB_QueryStatus qs; /* should be monotonically increasing */ @@ -778,12 +744,14 @@ handle_purse_merged ( merge_pub, merge_sig)) { - GNUNET_free (reserve_url); - bsl.row_id = rowid; - bsl.operation = "merge-purse"; - bsl.loss = *amount; - bsl.operation_specific_pub = merge_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "merge-purse", + .loss = *amount, + .operation_specific_pub = merge_pub->eddsa_pub + }; + GNUNET_free (reserve_url); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); @@ -791,18 +759,8 @@ handle_purse_merged ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "merge-purse"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("key_pub", - merge_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, amount); @@ -874,8 +832,6 @@ handle_account_merged ( { struct PurseContext *pc = cls; struct PurseSummary *ps; - struct TALER_AUDITORDB_BadSigLosses bsl; - enum GNUNET_DB_QueryStatus qs; /* should be monotonically increasing */ GNUNET_assert (rowid >= TALER_ARL_USE_PP (purse_account_merge_serial_id)); @@ -892,10 +848,13 @@ handle_account_merged ( reserve_pub, reserve_sig)) { - bsl.row_id = rowid; - bsl.operation = "account-merge"; - bsl.loss = *purse_fee; - bsl.operation_specific_pub = reserve_pub->eddsa_pub; + enum GNUNET_DB_QueryStatus qs; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "account-merge", + .loss = *purse_fee, + .operation_specific_pub = reserve_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -904,18 +863,8 @@ handle_account_merged ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "account-merge"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - purse_fee), - GNUNET_JSON_pack_data_auto ("key_pub", - reserve_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, purse_fee); @@ -1077,32 +1026,22 @@ handle_purse_expired ( struct GNUNET_TIME_Timestamp expiration_date) { struct PurseContext *pc = cls; - struct TALER_AUDITORDB_PurseNotClosedInconsistencies pnci; enum GNUNET_DB_QueryStatus qs; + struct TALER_AUDITORDB_PurseNotClosedInconsistencies pnci = { + .amount = *balance, + .expiration_date = expiration_date.abs_time, + .purse_pub = purse_pub->eddsa_pub + }; (void) pc; - pnci.amount = *balance; - pnci.expiration_date = expiration_date.abs_time; - pnci.purse_pub = purse_pub->eddsa_pub; - qs = TALER_ARL_adb->insert_purse_not_closed_inconsistencies ( TALER_ARL_adb->cls, &pnci); - if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_purse_not_closed_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("purse_pub", - purse_pub), - TALER_JSON_pack_amount ("balance", - balance), - TALER_JSON_pack_time_abs_human ("expired", - expiration_date.abs_time)) - ); TALER_ARL_amount_add (&total_delayed_decisions, &total_delayed_decisions, balance); diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c @@ -196,7 +196,6 @@ report_amount_arithmetic_inconsistency ( struct TALER_Amount delta; struct TALER_Amount *target; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_AmountArithmeticInconsistency aai; if (0 < TALER_amount_cmp (exchange, auditor)) @@ -214,33 +213,27 @@ report_amount_arithmetic_inconsistency ( auditor, exchange); } - aai.profitable = profitable; - aai.operation = (char *) operation; - aai.exchange_amount = *exchange; - aai.auditor_amount = *auditor; - qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( - TALER_ARL_adb->cls, - &aai); - - if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - } + struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = { + .row_id = rowid, + .profitable = profitable, + .operation = (char *) operation, + .exchange_amount = *exchange, + .auditor_amount = *auditor, + }; + qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency ( + TALER_ARL_adb->cls, + &aai); + + if (qs < 0) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling!!? + } + } - TALER_ARL_report (report_amount_arithmetic_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - operation), - GNUNET_JSON_pack_uint64 ("rowid", - rowid), - TALER_JSON_pack_amount ("exchange", - exchange), - TALER_JSON_pack_amount ("auditor", - auditor), - GNUNET_JSON_pack_int64 ("profitable", - profitable))); if (0 != profitable) { target = (1 == profitable) @@ -266,11 +259,11 @@ report_row_inconsistency (const char *table, const char *diagnostic) { enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_RowInconsistency ri; - - ri.diagnostic = (char *) diagnostic; - ri.row_table = (char *) table; - ri.row_id = rowid; + struct TALER_AUDITORDB_RowInconsistency ri = { + .diagnostic = (char *) diagnostic, + .row_table = (char *) table, + .row_id = rowid + }; qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, @@ -279,16 +272,8 @@ report_row_inconsistency (const char *table, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling!!? } - - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - table), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_string ("diagnostic", - diagnostic))); } @@ -595,8 +580,6 @@ handle_reserve_out (void *cls, struct TALER_Amount auditor_amount_with_fee; enum GNUNET_DB_QueryStatus qs; struct TALER_DenominationHashP h_denom_pub; - struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency dkvwi; - struct TALER_AUDITORDB_BadSigLosses bsl; /* should be monotonically increasing */ GNUNET_assert (rowid >= TALER_ARL_USE_PP (reserves_reserve_out_serial_id)); @@ -641,11 +624,12 @@ handle_reserve_out (void *cls, <, execution_date)) { - - dkvwi.row_id = rowid; - dkvwi.execution_date = execution_date.abs_time; - dkvwi.denompub_h = *&h_denom_pub; - dkvwi.reserve_pub = *reserve_pub; + struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency dkvwi ={ + .row_id = rowid, + .execution_date = execution_date.abs_time, + .denompub_h = *&h_denom_pub, + .reserve_pub = *reserve_pub + }; qs = TALER_ARL_adb->insert_denomination_key_validity_withdraw_inconsistency ( @@ -655,19 +639,8 @@ handle_reserve_out (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + /* FIXME: error handling! */ } - - TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_time_abs_human ("execution_date", - execution_date.abs_time) - , - GNUNET_JSON_pack_data_auto ("reserve_pub", - reserve_pub), - GNUNET_JSON_pack_data_auto ("denompub_h", - &h_denom_pub))); } /* check reserve_sig (first: setup remaining members of wsrd) */ @@ -678,10 +651,12 @@ handle_reserve_out (void *cls, reserve_pub, reserve_sig)) { - bsl.row_id = rowid; - bsl.operation = "withdraw"; - bsl.loss = *amount_with_fee; - bsl.operation_specific_pub = reserve_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "withdraw", + .loss = *amount_with_fee, + .operation_specific_pub = reserve_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -690,18 +665,8 @@ handle_reserve_out (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "withdraw"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount_with_fee), - GNUNET_JSON_pack_data_auto ("key_pub", - reserve_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, amount_with_fee); @@ -785,8 +750,6 @@ handle_recoup_by_reserve ( uint64_t rev_rowid; enum GNUNET_DB_QueryStatus qs; const char *rev; - struct TALER_AUDITORDB_BadSigLosses bslr; - struct TALER_AUDITORDB_BadSigLosses bslrm; (void) denom_pub; /* should be monotonically increasing */ @@ -800,10 +763,12 @@ handle_recoup_by_reserve ( &coin->coin_pub, coin_sig)) { - bslr.row_id = rowid; - bslr.operation = "recoup"; - bslr.loss = *amount; - bslr.operation_specific_pub = coin->coin_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bslr = { + .row_id = rowid, + .operation = "recoup", + .loss = *amount, + .operation_specific_pub = coin->coin_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -812,18 +777,8 @@ handle_recoup_by_reserve ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "recoup"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("key_pub", - &coin->coin_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, amount); @@ -884,10 +839,12 @@ handle_recoup_by_reserve ( (0 == strcmp (rev, "master signature invalid"))) { - bslrm.row_id = rev_rowid; - bslrm.operation = "recoup-master"; - bslrm.loss = *amount; - bslrm.operation_specific_pub = TALER_ARL_master_pub.eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bslrm = { + .row_id = rev_rowid, + .operation = "recoup-master", + .loss = *amount, + .operation_specific_pub = TALER_ARL_master_pub.eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -897,17 +854,6 @@ handle_recoup_by_reserve ( { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "recoup-master"), - GNUNET_JSON_pack_uint64 ("row", - rev_rowid), - TALER_JSON_pack_amount ("loss", - amount), - GNUNET_JSON_pack_data_auto ("key_pub", - &TALER_ARL_master_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, amount); @@ -1019,7 +965,6 @@ handle_reserve_open ( struct ReserveContext *rc = cls; struct ReserveSummary *rs; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; /* should be monotonically increasing */ GNUNET_assert (rowid >= TALER_ARL_USE_PP (reserves_reserve_open_serial_id)); @@ -1040,11 +985,12 @@ handle_reserve_open ( reserve_pub, reserve_sig)) { - - bsl.row_id = rowid; - bsl.operation = "reserve-open"; - bsl.loss = *reserve_payment; - bsl.operation_specific_pub = reserve_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "reserve-open", + .loss = *reserve_payment, + .operation_specific_pub = reserve_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -1053,18 +999,8 @@ handle_reserve_open ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "reserve-open"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - reserve_payment), - GNUNET_JSON_pack_data_auto ("reserve_pub", - reserve_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, reserve_payment); @@ -1172,7 +1108,6 @@ handle_reserve_closed ( struct TALER_Amount close_fee; char *payto_uri; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; qs = TALER_ARL_edb->select_reserve_close_request_info ( TALER_ARL_edb->cls, @@ -1202,10 +1137,12 @@ handle_reserve_closed ( reserve_pub, &reserve_sig)) { - bsl.row_id = close_request_row; - bsl.operation = "close-request"; - bsl.loss = *amount_with_fee; - bsl.operation_specific_pub = reserve_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = close_request_row, + .operation = "close-request", + .loss = *amount_with_fee, + .operation_specific_pub = reserve_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -1214,18 +1151,8 @@ handle_reserve_closed ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "close-request"), - GNUNET_JSON_pack_uint64 ("row", - close_request_row), - TALER_JSON_pack_amount ("loss", - amount_with_fee), - GNUNET_JSON_pack_data_auto ("reserve_pub", - reserve_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, amount_with_fee); @@ -1327,7 +1254,6 @@ handle_account_merged ( struct ReserveContext *rc = cls; struct ReserveSummary *rs; enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_BadSigLosses bsl; /* should be monotonically increasing */ GNUNET_assert (rowid >= TALER_ARL_USE_PP (reserves_account_merges_serial_id)); @@ -1344,10 +1270,12 @@ handle_account_merged ( reserve_pub, reserve_sig)) { - bsl.row_id = rowid; - bsl.operation = "account-merge"; - bsl.loss = *purse_fee; - bsl.operation_specific_pub = reserve_pub->eddsa_pub; + struct TALER_AUDITORDB_BadSigLosses bsl = { + .row_id = rowid, + .operation = "account-merge", + .loss = *purse_fee, + .operation_specific_pub = reserve_pub->eddsa_pub + }; qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, @@ -1356,18 +1284,8 @@ handle_account_merged ( if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_bad_sig_losses, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("operation", - "account-merge"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("loss", - purse_fee), - GNUNET_JSON_pack_data_auto ("key_pub", - reserve_pub))); TALER_ARL_amount_add (&total_bad_sig_loss, &total_bad_sig_loss, purse_fee); @@ -1459,11 +1377,6 @@ verify_reserve_balance (void *cls, struct TALER_Amount nbalance; enum GNUNET_DB_QueryStatus qs; enum GNUNET_GenericReturnValue ret; - struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiil; - struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig; - struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency rbswi; - struct TALER_AUDITORDB_ReserveNotClosedInconsistency rnci; - struct TALER_AUDITORDB_ReserveNotClosedInconsistency rncid; ret = GNUNET_OK; /* Check our reserve summary balance calculation shows that @@ -1476,23 +1389,20 @@ verify_reserve_balance (void *cls, &mbalance, &rs->total_out)) { + struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiil = { + .reserve_pub = rs->reserve_pub.eddsa_pub, + .inconsistency_gain = false + }; - struct TALER_Amount loss; - - TALER_ARL_amount_subtract (&loss, + TALER_ARL_amount_subtract (&rbiil.inconsistency_amount, &rs->total_out, &mbalance); TALER_ARL_amount_add (&rs->curr_balance.reserve_loss, &rs->prev_balance.reserve_loss, - &loss); + &rbiil.inconsistency_amount); TALER_ARL_amount_add (&TALER_ARL_USE_AB (reserves_reserve_loss), &TALER_ARL_USE_AB (reserves_reserve_loss), - &loss); - - rbiil.reserve_pub = rs->reserve_pub.eddsa_pub; - rbiil.inconsistency_amount = loss; - rbiil.inconsistency_gain = false; - + &rbiil.inconsistency_amount); qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( TALER_ARL_adb->cls, &rbiil); @@ -1500,14 +1410,8 @@ verify_reserve_balance (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling! } - - TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rs->reserve_pub), - TALER_JSON_pack_amount ("loss", - &loss))); /* Continue with a reserve balance of zero */ GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, @@ -1538,9 +1442,12 @@ verify_reserve_balance (void *cls, We don't add the amount to some total simply because it is not an actualized gain and could be trivially corrected by restoring the summary. */ - rbiig.reserve_pub = rs->reserve_pub.eddsa_pub; - rbiig.inconsistency_amount = nbalance; - rbiig.inconsistency_gain = true; + struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig = { + .reserve_pub = rs->reserve_pub.eddsa_pub, + .inconsistency_amount = nbalance, + .inconsistency_gain = true + }; + qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( TALER_ARL_adb->cls, &rbiig); @@ -1548,15 +1455,8 @@ verify_reserve_balance (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - - TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rs->reserve_pub), - TALER_JSON_pack_amount ("gain", - &nbalance))); if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { GNUNET_break (0); @@ -1594,40 +1494,44 @@ verify_reserve_balance (void *cls, &total_balance_summary_delta_minus, &delta); } - rbiig.reserve_pub = rs->reserve_pub.eddsa_pub; - rbiig.inconsistency_amount = nbalance; - rbiig.inconsistency_gain = true; - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiig); + { + struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig = + { + .reserve_pub = rs->reserve_pub.eddsa_pub, + .inconsistency_amount = nbalance, + .inconsistency_gain = true + }; + + qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency + ( + TALER_ARL_adb->cls, + &rbiig); + } if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - rbswi.exchange_amount = reserve.balance; - rbswi.auditor_amount = rs->curr_balance.reserve_balance; - rbswi.reserve_pub = rs->reserve_pub; - - qs = TALER_ARL_adb->insert_reserve_balance_summary_wrong_inconsistency ( - TALER_ARL_adb->cls, - &rbswi); + { + struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency rbswi = + { + .exchange_amount = reserve.balance, + .auditor_amount = rs->curr_balance.reserve_balance, + .reserve_pub = rs->reserve_pub + }; + + qs = TALER_ARL_adb->insert_reserve_balance_summary_wrong_inconsistency + ( + TALER_ARL_adb->cls, + &rbswi); + } if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - TALER_ARL_report (report_reserve_balance_summary_wrong_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rs->reserve_pub), - TALER_JSON_pack_amount ("exchange", - &reserve.balance), - TALER_JSON_pack_amount ("auditor", - &rs->curr_balance. - reserve_balance))); } } } /* end of 'if (internal_checks)' */ @@ -1652,14 +1556,15 @@ verify_reserve_balance (void *cls, if (1 == TALER_amount_cmp (&nbalance, &cfee)) { + struct TALER_AUDITORDB_ReserveNotClosedInconsistency rnci = { + .reserve_pub = rs->reserve_pub, + .expiration_time = rs->a_expiration_date.abs_time + }; + /* remaining balance (according to us) exceeds closing fee */ TALER_ARL_amount_add (&total_balance_reserve_not_closed, &total_balance_reserve_not_closed, - &nbalance); - rnci.reserve_pub = rs->reserve_pub; - rnci.balance = nbalance; - rnci.expiration_time = rs->a_expiration_date.abs_time; - + &rnci.balance); qs = TALER_ARL_adb->insert_reserve_not_closed_inconsistency ( TALER_ARL_adb->cls, &rnci); @@ -1667,16 +1572,8 @@ verify_reserve_balance (void *cls, if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - TALER_ARL_report ( - report_reserve_not_closed_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rs->reserve_pub), - TALER_JSON_pack_amount ("balance", - &nbalance), - TALER_JSON_pack_time_abs_human ("expiration_time", - rs->a_expiration_date.abs_time))); } } else @@ -1688,30 +1585,23 @@ verify_reserve_balance (void *cls, /*TALER_ARL_amount_add (&total_balance_reserve_not_closed, &total_balance_reserve_not_closed, &nbalance);*/ - rncid.reserve_pub = rs->reserve_pub; - rncid.balance = (nbalance.value) ? total_balance_reserve_not_closed : - nbalance; - rncid.expiration_time = rs->a_expiration_date.abs_time; - rncid.diagnostic = "could not determine closing fee"; + struct TALER_AUDITORDB_ReserveNotClosedInconsistency rncid = { + .reserve_pub = rs->reserve_pub, + .balance = (nbalance.value) + ? total_balance_reserve_not_closed + : nbalance, + .expiration_time = rs->a_expiration_date.abs_time, + .diagnostic = "could not determine closing fee" + }; + qs = TALER_ARL_adb->insert_reserve_not_closed_inconsistency ( TALER_ARL_adb->cls, &rncid); if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + // FIXME: error handling } - - /*TALER_ARL_report ( - report_reserve_not_closed_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rs->reserve_pub), - TALER_JSON_pack_amount ("balance", - &nbalance), - TALER_JSON_pack_time_abs_human ("expiration_time", - rs->a_expiration_date.abs_time), - GNUNET_JSON_pack_string ("diagnostic", - "could not determine closing fee")));*/ } } /* We already computed the 'new' balance in 'curr_balance' diff --git a/src/auditor/taler-helper-auditor-wire-credit.c b/src/auditor/taler-helper-auditor-wire-credit.c @@ -526,18 +526,6 @@ reserve_in_cb (void *cls, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return GNUNET_SYSERR; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - "reserves_in"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_data_auto ("id", - &rii->row_off_hash), - GNUNET_JSON_pack_string ("diagnostic", - "duplicate wire offset"))); -#endif if (TALER_ARL_do_abort ()) return GNUNET_SYSERR; return GNUNET_OK; @@ -587,26 +575,6 @@ complain_in_not_found (void *cls, global_qs = qs; return GNUNET_SYSERR; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report ( - report_reserve_in_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rii->rowid), - TALER_JSON_pack_amount ("amount_exchange_expected", - &rii->credit_details.amount), - TALER_JSON_pack_amount ("amount_wired", - &zero), - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rii->credit_details.reserve.reserve_pub), - TALER_JSON_pack_time_abs_human ("timestamp", - rii->credit_details.execution_date. - abs_time), - GNUNET_JSON_pack_string ("account", - wa->ai->section_name), - GNUNET_JSON_pack_string ("diagnostic", - "incoming wire transfer claimed by exchange not found"))); -#endif TALER_ARL_amount_add (&total_bad_amount_in_minus, &total_bad_amount_in_minus, &rii->credit_details.amount); @@ -717,27 +685,6 @@ analyze_credit ( GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return false; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report ( - report_reserve_in_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rii->rowid), - GNUNET_JSON_pack_uint64 ("bank_row", - credit_details->serial_id), - TALER_JSON_pack_amount ("amount_exchange_expected", - &rii->credit_details.amount), - TALER_JSON_pack_amount ("amount_wired", - &zero), - GNUNET_JSON_pack_data_auto ("reserve_pub", - &rii->credit_details.details.reserve. - reserve_pub), - TALER_JSON_pack_time_abs_human ("timestamp", - rii->credit_details.execution_date. - abs_time), - GNUNET_JSON_pack_string ("diagnostic", - "wire subject does not match"))); -#endif TALER_ARL_amount_add (&total_bad_amount_in_minus, &total_bad_amount_in_minus, &rii->credit_details.amount); @@ -773,27 +720,6 @@ analyze_credit ( GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return false; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report ( - report_reserve_in_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rii->rowid), - GNUNET_JSON_pack_uint64 ("bank_row", - credit_details->serial_id), - TALER_JSON_pack_amount ("amount_exchange_expected", - &rii->credit_details.amount), - TALER_JSON_pack_amount ("amount_wired", - &credit_details->amount), - GNUNET_JSON_pack_data_auto ("reserve_pub", - &credit_details->details.reserve.reserve_pub - ), - TALER_JSON_pack_time_abs_human ("timestamp", - credit_details->execution_date.abs_time) - , - GNUNET_JSON_pack_string ("diagnostic", - "wire amount does not match"))); -#endif if (0 < TALER_amount_cmp (&credit_details->amount, &rii->credit_details.amount)) { @@ -840,19 +766,6 @@ analyze_credit ( GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return false; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report (report_misattribution_in_inconsistencies, - GNUNET_JSON_PACK ( - TALER_JSON_pack_amount ("amount", - &rii->credit_details.amount), - GNUNET_JSON_pack_uint64 ("row", - rii->rowid), - GNUNET_JSON_pack_uint64 ("bank_row", - credit_details->serial_id), - GNUNET_JSON_pack_data_auto ( - "reserve_pub", - &rii->credit_details.details.reserve.reserve_pub))); -#endif TALER_ARL_amount_add (&total_misattribution_in, &total_misattribution_in, &rii->credit_details.amount); @@ -878,18 +791,6 @@ analyze_credit ( GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return false; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report (report_row_minor_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - "reserves_in"), - GNUNET_JSON_pack_uint64 ("row", - rii->rowid), - GNUNET_JSON_pack_uint64 ("bank_row", - credit_details->serial_id), - GNUNET_JSON_pack_string ("diagnostic", - "execution date mismatch"))); -#endif } return true; } diff --git a/src/auditor/taler-helper-auditor-wire-debit.c b/src/auditor/taler-helper-auditor-wire-debit.c @@ -162,6 +162,12 @@ static struct GNUNET_CONTAINER_MultiHashMap *reserve_closures; static int global_ret; /** + * State of the current database transaction with + * the auditor DB. + */ +static enum GNUNET_DB_QueryStatus global_qs; + +/** * Map with information about outgoing wire transfers. * Maps hashes of the wire subjects (in binary encoding) * to `struct ReserveOutInfo`s. @@ -199,27 +205,27 @@ static struct TALER_Amount tiny_amount; /** * Total amount that was transferred too much from the exchange. */ -static struct TALER_Amount total_bad_amount_out_plus; +static TALER_ARL_DEF_AB (total_bad_amount_out_plus); /** * Total amount that was transferred too little from the exchange. */ -static struct TALER_Amount total_bad_amount_out_minus; +static TALER_ARL_DEF_AB (total_bad_amount_out_minus); /** * Total amount which the exchange did not transfer in time. */ -static struct TALER_Amount total_amount_lag; +static TALER_ARL_DEF_AB (total_amount_lag); /** * Total amount of reserve closures which the exchange did not transfer in time. */ -static struct TALER_Amount total_closure_amount_lag; +static TALER_ARL_DEF_AB (total_closure_amount_lag); /** - * Total amount affected by wire format trouble.s + * Total amount affected by wire format troubles. */ -static struct TALER_Amount total_wire_format_amount; // FIXME +static TALER_ARL_DEF_AB (total_wire_format_amount); /** * Total amount debited to exchange accounts. @@ -232,16 +238,6 @@ static TALER_ARL_DEF_AB (total_wire_out); static TALER_ARL_DEF_AB (total_drained); /** - * Final balance at the end of this iteration. - */ -// static TALER_ARL_DEF_AB (final_balance); // KILL - -/** - * Starting balance at the beginning of this iteration. - */ -static struct TALER_Amount start_balance; // for total_wire_out - -/** * True if #start_balance was initialized. */ static bool had_start_balance; @@ -277,7 +273,9 @@ static int internal_checks; */ static int ignore_account_404; -// FIXME: comment +/** + * Database event handler to wake us up again. + */ static struct GNUNET_DB_EventHandler *eh; /** @@ -290,7 +288,6 @@ static struct TALER_AUDITORDB_Plugin *db_plugin; */ static const struct GNUNET_CONFIGURATION_Handle *cfg; -/* ***************************** Shutdown **************************** */ /** * Entry in map with wire information we expect to obtain from the @@ -446,46 +443,31 @@ check_pending_rc (void *cls, void *value) { struct ReserveClosure *rc = value; - /*enum GNUNET_DB_QueryStatus qs; - struct TALER_AUDITORDB_ClosureLags cl;*/ (void) cls; (void) key; - TALER_ARL_amount_add (&total_closure_amount_lag, - &total_closure_amount_lag, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_closure_amount_lag), + &TALER_ARL_USE_AB (total_closure_amount_lag), &rc->amount); if (! TALER_amount_is_zero (&rc->amount)) { -#if FIXME - - cl.account = rc->receiver_account; - cl.amount = &rc->amount; - cl.deadline = rc->execution_date.abs_time; - cl.wtid = &rc->wtid; + struct TALER_AUDITORDB_ClosureLags cl = { + .account = rc->receiver_account, + .amount = rc->amount, + .deadline = rc->execution_date.abs_time, + .wtid = rc->wtid + }; + enum GNUNET_DB_QueryStatus qs; qs = TALER_ARL_adb->insert_auditor_closure_lags ( TALER_ARL_adb->cls, &cl); - if (qs < 0) { + global_qs = qs; GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; } - - TALER_ARL_report ( - report_closure_lags, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rc->rowid), - TALER_JSON_pack_amount ("amount", - &rc->amount), - TALER_JSON_pack_time_abs_human ("deadline", - rc->execution_date.abs_time), - GNUNET_JSON_pack_data_auto ("wtid", - &rc->wtid), - GNUNET_JSON_pack_string ("account", - rc->receiver_account))); -#endif } TALER_ARL_USE_PP (wire_reserve_close_id) = GNUNET_MIN (TALER_ARL_USE_PP (wire_reserve_close_id), @@ -571,7 +553,7 @@ commit (enum GNUNET_DB_QueryStatus qs) qs = TALER_ARL_adb->update_auditor_progress ( TALER_ARL_adb->cls, wa->label_wire_out_serial_id, - wa->pp.last_wire_out_serial_id, + wa->last_wire_out_serial_id, wa->label_wire_off_out, wa->wire_off_out, NULL); @@ -579,7 +561,7 @@ commit (enum GNUNET_DB_QueryStatus qs) qs = TALER_ARL_adb->insert_auditor_progress ( TALER_ARL_adb->cls, wa->label_wire_out_serial_id, - wa->pp.last_wire_out_serial_id, + wa->last_wire_out_serial_id, wa->label_wire_off_out, wa->wire_off_out, NULL); @@ -714,6 +696,11 @@ import_wire_missing_cb (void *cls, struct ReasonDetail { /** + * Batch deposit that may be lacking a wire transfer. + */ + uint64_t batch_deposit_serial_id; + + /** * Total amount that should have been transferred. */ struct TALER_Amount total_amount; @@ -724,25 +711,9 @@ struct ReasonDetail struct GNUNET_TIME_Timestamp deadline; /** - * Target account, NULL if even that is not known (due to - * exchange lacking required entry in wire_targets table). + * Target account hash. */ - char *payto_uri; - - /** - * Account properties, possibly NULL. - */ - json_t *properties; - - /** - * Account KYC rules. - */ - json_t *jrules; - - /** - * TODO: Is the wire transfer blocked due to KYC/AML checks, according to the exchange? - */ - /* bool is_blocked_because_of_kyc_aml; */ + struct TALER_PaytoHashP wire_target_h_payto; }; @@ -797,9 +768,6 @@ free_report_entry (void *cls, { struct ReasonDetail *rd = value; - json_decref (rd->properties); - json_decref (rd->jrules); - GNUNET_free (rd->payto_uri); GNUNET_free (rd); return GNUNET_YES; } @@ -815,7 +783,6 @@ free_report_entry (void *cls, * @return #GNUNET_YES if we should continue to * iterate, * #GNUNET_NO if not. - * FIXME: */ static enum GNUNET_GenericReturnValue generate_report (void *cls, @@ -823,11 +790,7 @@ generate_report (void *cls, void *value) { struct ReasonDetail *rd = value; - // FIXME: - // enum GNUNET_DB_QueryStatus qs; - // struct TALER_AUDITORDB_KycLag kycl; - // struct TALER_AUDITORDB_AmlLag amllag; - // struct TALER_AUDITORDB_Lag lag; + /* For now, we simplify and only check that the amount was tiny */ @@ -837,123 +800,26 @@ generate_report (void *cls, key, value); /* acceptable, amount was tiny */ -#if FIXME // TODO: maybe split total_amount_lag up by category below? - TALER_ARL_amount_add (&total_amount_lag, - &total_amount_lag, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_amount_lag), + &TALER_ARL_USE_AB (total_amount_lag), &rd->total_amount); - if (NULL != rd->kyc_pending) - { - json_t *rep; - - rep = GNUNET_JSON_PACK ( - TALER_JSON_pack_amount ("total_amount", - &rd->total_amount), - TALER_JSON_pack_time_abs_human ("deadline", - rd->deadline.abs_time), - GNUNET_JSON_pack_object_incref ("kyc_rules", - rd->rules), - GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_object_incref ("properties", - rd->properties)), - GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_string ("account", - rd->payto_uri))); - // TODO add kyc lag db entry - /*rbiil.reserve_pub = rs->reserve_pub.eddsa_pub; - rbiil.inconsistency_amount = loss; - rbiil.inconsistency_gain = false; - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); - - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - - TALER_ARL_report (report_kyc_lags, - rep); - } - else if (TALER_AML_NORMAL != rd->status) { - const char *sstatus = "<undefined>"; - json_t *rep; - - switch (rd->status) - { - case TALER_AML_NORMAL: - GNUNET_assert (0); - break; - case TALER_AML_PENDING: - sstatus = "pending"; - break; - case TALER_AML_FROZEN: - sstatus = "frozen"; - break; - } - rep = GNUNET_JSON_PACK ( - TALER_JSON_pack_amount ("total_amount", - &rd->total_amount), - GNUNET_JSON_pack_allow_null ( - TALER_JSON_pack_amount ("aml_limit", - TALER_amount_is_valid (&rd->aml_limit) - ? &rd->aml_limit - : NULL)), - TALER_JSON_pack_time_abs_human ("deadline", - rd->deadline.abs_time), - GNUNET_JSON_pack_string ("aml_status", - sstatus), - GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_string ("account", - rd->payto_uri))); - // TODO add aml lag db entry - /*rbiil.reserve_pub = rs->reserve_pub.eddsa_pub; - rbiil.inconsistency_amount = loss; - rbiil.inconsistency_gain = false; - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); + enum GNUNET_DB_QueryStatus qs; - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report (report_aml_lags, - rep); - } - else - { - json_t *rep; - - rep = GNUNET_JSON_PACK ( - TALER_JSON_pack_amount ("total_amount", - &rd->total_amount), - TALER_JSON_pack_time_abs_human ("deadline", - rd->deadline.abs_time), - GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_string ("account", - rd->payto_uri))); - // TODO add lag - /*rbiil.reserve_pub = rs->reserve_pub.eddsa_pub; - rbiil.inconsistency_amount = loss; - rbiil.inconsistency_gain = false; - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( + qs = TALER_ARL_adb->insert_pending_deposit ( TALER_ARL_adb->cls, - &rbiil); - + rd->batch_deposit_serial_id, + &rd->wire_target_h_payto, + &rd->total_amount, + rd->deadline); if (qs < 0) { + global_qs = qs; GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report (report_lags, - rep); + return GNUNET_SYSERR; + } } -#endif - return free_report_entry (cls, key, value); @@ -961,7 +827,6 @@ generate_report (void *cls, /** - * FIXME: * Function called on deposits that are past their due date * and have not yet seen a wire transfer. * @@ -986,20 +851,16 @@ report_wire_missing_cb (void *cls, if (NULL == rd) { rd = GNUNET_new (struct ReasonDetail); + rd->batch_deposit_serial_id = batch_deposit_serial_id; + rd->wire_target_h_payto = *wire_target_h_payto; + rd->total_amount = *total_amount; + rd->deadline = deadline; GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_put ( rc->map, &wire_target_h_payto->hash, rd, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); - rc->err = TALER_ARL_edb->select_justification_for_missing_wire ( - TALER_ARL_edb->cls, - wire_target_h_payto, - &rd->payto_uri, - &rd->properties, - &rd->jrules); - rd->total_amount = *total_amount; - rd->deadline = deadline; } else { @@ -1127,8 +988,12 @@ check_for_required_transfers (void) NULL); GNUNET_CONTAINER_multishortmap_destroy (rc.map); /* conclude with success */ - commit (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT); - GNUNET_SCHEDULER_shutdown (); + commit (global_qs); + if (test_mode) + { + GNUNET_SCHEDULER_shutdown (); + return; + } } @@ -1154,8 +1019,9 @@ conclude_wire_out (void) * @param rowid what is the row * @param want what is the expected time * @param have what is the time we got + * @return true on success, false to abort */ -static void +static bool check_time_difference (const char *table, uint64_t rowid, struct GNUNET_TIME_Timestamp want, @@ -1163,8 +1029,6 @@ check_time_difference (const char *table, { struct GNUNET_TIME_Relative delta; char *details; - // enum GNUNET_DB_QueryStatus qs; - // struct TALER_AUDITORDB_RowMinorInconsistencies rmi; if (GNUNET_TIME_timestamp_cmp (have, >, want)) delta = GNUNET_TIME_absolute_get_difference (want.abs_time, @@ -1175,35 +1039,34 @@ check_time_difference (const char *table, if (GNUNET_TIME_relative_cmp (delta, <=, TIME_TOLERANCE)) - return; + return true; GNUNET_asprintf (&details, "execution date mismatch (%s)", GNUNET_TIME_relative2s (delta, true)); -#if FIXME - - rmi.diagnostic = details; - rmi.row_table = (char *) table; + { + struct TALER_AUDITORDB_RowMinorInconsistencies rmi = { + .row_id = rowid, + .diagnostic = details, + .row_table = (char *) table + }; + enum GNUNET_DB_QueryStatus qs; - qs = TALER_ARL_adb->insert_row_minor_inconsistencies ( - TALER_ARL_adb->cls, - &rmi); + qs = TALER_ARL_adb->insert_row_minor_inconsistencies ( + TALER_ARL_adb->cls, + &rmi); - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + if (qs < 0) + { + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + GNUNET_free (details); + return false; + } } - TALER_ARL_report (report_row_minor_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - table), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_string ("diagnostic", - details))); -#endif GNUNET_free (details); + return true; } @@ -1230,22 +1093,18 @@ wire_out_cb (void *cls, struct WireAccount *wa = cls; struct GNUNET_HashCode key; struct ReserveOutInfo *roi; - /*struct TALER_AUDITORDB_WireOutInconsistency woi; - struct TALER_AUDITORDB_WireOutInconsistency woi2; - struct TALER_AUDITORDB_WireOutInconsistency woi3; - struct TALER_AUDITORDB_WireOutInconsistency woi4; - enum GNUNET_DB_QueryStatus qs; */ + enum GNUNET_GenericReturnValue ret = GNUNET_OK; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Exchange wire OUT at %s of %s with WTID %s\n", GNUNET_TIME_timestamp2s (date), TALER_amount2s (amount), TALER_B2S (wtid)); - TALER_ARL_amount_add (&total_wire_out, - &total_wire_out, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_wire_out), + &TALER_ARL_USE_AB (total_wire_out), amount); GNUNET_CRYPTO_hash (wtid, - sizeof (struct TALER_WireTransferIdentifierRawP), + sizeof (*wtid), &key); roi = GNUNET_CONTAINER_multihashmap_get (out_map, &key); @@ -1255,38 +1114,26 @@ wire_out_cb (void *cls, justified), so the entire amount is missing / still to be done. This is moderately harmless, it might just be that the aggregator has not yet fully caught up with the transfers it should do. */ -#if FIXME -// TODO fix woi implementation - /* woi. - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); - - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report ( - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount_wired", - &zero), - TALER_JSON_pack_amount ("amount_justified", - amount), - GNUNET_JSON_pack_data_auto ("wtid", - wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - date.abs_time), - GNUNET_JSON_pack_string ("diagnostic", - "wire transfer not made (yet?)"), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_minus, - &total_bad_amount_out_minus, + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = rowid, + .destination_account = (char *) payto_uri, + .diagnostic = "expected wire transfer missing", + .expected = *amount, + .claimed = zero, + }; + enum GNUNET_DB_QueryStatus qs; + + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); + if (qs < 0) + { + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; + } + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus), + &TALER_ARL_USE_AB (total_bad_amount_out_minus), amount); if (TALER_ARL_do_abort ()) return GNUNET_SYSERR; @@ -1298,109 +1145,53 @@ wire_out_cb (void *cls, /* Destination bank account is wrong in actual wire transfer, so we should count the wire transfer as entirely spurious, and additionally consider the justified wire transfer as missing. */ -#if FIXME - /* woi2. - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = rowid, + .destination_account = (char *) payto_uri, + .diagnostic = "receiver account mismatch", + .expected = *amount, + .claimed = zero, + }; + enum GNUNET_DB_QueryStatus qs; + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report ( - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount_wired", - &roi->details.amount), - TALER_JSON_pack_amount ("amount_justified", - &zero), - GNUNET_JSON_pack_data_auto ("wtid", - wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - date.abs_time), - GNUNET_JSON_pack_string ("diagnostic", - "receiver account mismatch"), - GNUNET_JSON_pack_string ("target", - payto_uri), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; + } + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &roi->details.amount); -#if FIXME - TALER_ARL_report ( - /* woi3. - -qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); - -if (qs < 0) -{ - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); -}*/ - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount_wired", - &zero), - TALER_JSON_pack_amount ("amount_justified", - amount), - GNUNET_JSON_pack_data_auto ("wtid", - wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - date.abs_time), - GNUNET_JSON_pack_string ("diagnostic", - "receiver account mismatch"), - GNUNET_JSON_pack_string ("target", - roi->details. - credit_account_uri), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_minus, - &total_bad_amount_out_minus, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus), + &TALER_ARL_USE_AB (total_bad_amount_out_minus), amount); - goto cleanup; + return GNUNET_OK; } if (0 != TALER_amount_cmp (&roi->details.amount, amount)) { -#if FIXME - TALER_ARL_report ( - /* woi4. - -qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = rowid, + .destination_account = (char *) payto_uri, + .diagnostic = "wire amount does not match", + .expected = *amount, + .claimed = zero, + }; + enum GNUNET_DB_QueryStatus qs; -if (qs < 0) -{ - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); -}*/ - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - rowid), - TALER_JSON_pack_amount ("amount_justified", - amount), - TALER_JSON_pack_amount ("amount_wired", - &roi->details.amount), - GNUNET_JSON_pack_data_auto ("wtid", - wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - date.abs_time), - GNUNET_JSON_pack_string ("diagnostic", - "wire amount does not match"), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name))); -#endif + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); + if (qs < 0) + { + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; + } if (0 < TALER_amount_cmp (amount, &roi->details.amount)) { @@ -1410,8 +1201,8 @@ if (qs < 0) TALER_ARL_amount_subtract (&delta, amount, &roi->details.amount); - TALER_ARL_amount_add (&total_bad_amount_out_minus, - &total_bad_amount_out_minus, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus), + &TALER_ARL_USE_AB (total_bad_amount_out_minus), &delta); } else @@ -1422,26 +1213,26 @@ if (qs < 0) TALER_ARL_amount_subtract (&delta, &roi->details.amount, amount); - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &delta); } - goto cleanup; + return GNUNET_OK; } - check_time_difference ("wire_out", - rowid, - date, - roi->details.execution_date); -cleanup: + if (! check_time_difference ("wire_out", + rowid, + date, + roi->details.execution_date)) + ret = GNUNET_SYSERR; GNUNET_assert (GNUNET_OK == free_roi (NULL, &key, roi)); - wa->pp.last_wire_out_serial_id = rowid + 1; + wa->last_wire_out_serial_id = rowid + 1; if (TALER_ARL_do_abort ()) return GNUNET_SYSERR; - return GNUNET_OK; + return ret; } @@ -1485,10 +1276,16 @@ check_rc_matches (void *cls, (0 == TALER_amount_cmp (&rc->amount, &ctx->roi->details.amount))) { - check_time_difference ("reserves_closures", - rc->rowid, - rc->execution_date, - ctx->roi->details.execution_date); + if (! check_time_difference ("reserves_closures", + rc->rowid, + rc->execution_date, + ctx->roi->details.execution_date)) + { + free_rc (NULL, + key, + rc); + return GNUNET_SYSERR; + } ctx->found = true; free_rc (NULL, key, @@ -1542,10 +1339,6 @@ complain_out_not_found (void *cls, struct GNUNET_TIME_Timestamp request_timestamp; struct TALER_Amount amount; struct TALER_MasterSignatureP master_sig; - // struct TALER_AUDITORDB_RowInconsistency ri; - // struct TALER_AUDITORDB_WireOutInconsistency woi; - // struct TALER_AUDITORDB_WireOutInconsistency woi2; - // struct TALER_AUDITORDB_WireOutInconsistency woi3; qs = TALER_ARL_edb->get_drain_profit (TALER_ARL_edb->cls, &roi->details.wtid, @@ -1584,113 +1377,77 @@ complain_out_not_found (void *cls, &TALER_ARL_master_pub, &master_sig)) { - GNUNET_break (0); -#if FIXME - ri.row_table = "profit_drains"; - ri.diagnostic = "invalid signature"; + struct TALER_AUDITORDB_RowInconsistency ri = { + .row_id = roi->details.serial_id, + .row_table = "profit_drains", + .diagnostic = "invalid signature" + }; + GNUNET_break (0); qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, &ri); - if (qs < 0) { + global_qs = qs; GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; } - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - "profit_drains"), - GNUNET_JSON_pack_uint64 ("row", - serial), - GNUNET_JSON_pack_data_auto ("id", - &roi->details.wtid), - GNUNET_JSON_pack_string ("diagnostic", - "invalid signature"))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &amount); } else if (0 != strcasecmp (payto_uri, roi->details.credit_account_uri)) { -#if FIXME - // TODO fix woi - /* woi. - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); - - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report ( - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - serial), - TALER_JSON_pack_amount ("amount_wired", - &roi->details.amount), - TALER_JSON_pack_amount ("amount_wired", - &amount), - GNUNET_JSON_pack_data_auto ("wtid", - &roi->details.wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - roi->details.execution_date.abs_time - ), - GNUNET_JSON_pack_string ("account", - wa->ai->section_name), - GNUNET_JSON_pack_string ("diagnostic", - "wrong target account"))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = serial, + .destination_account = (char *) roi->details.credit_account_uri, + .diagnostic = "amount wired to invalid account", + .expected = roi->details.amount, + .claimed = zero, + }; + + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); + if (qs < 0) + { + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; + } + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &amount); } else if (0 != TALER_amount_cmp (&amount, &roi->details.amount)) { -#if FIXME - // TODO fix woi - /* woi. - - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); - - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report ( - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - serial), - TALER_JSON_pack_amount ("amount_justified", - &roi->details.amount), - TALER_JSON_pack_amount ("amount_wired", - &amount), - GNUNET_JSON_pack_data_auto ("wtid", - &roi->details.wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - roi->details.execution_date.abs_time - ), - GNUNET_JSON_pack_string ("account", - wa->ai->section_name), - GNUNET_JSON_pack_string ("diagnostic", - "profit drain amount incorrect"))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_minus, - &total_bad_amount_out_minus, + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = roi->details.serial_id, + .destination_account = (char *) roi->details.credit_account_uri, + .diagnostic = "incorrect amount to correct account", + .expected = roi->details.amount, + .claimed = amount, + }; + + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); + if (qs < 0) + { + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; + } + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus), + &TALER_ARL_USE_AB (total_bad_amount_out_minus), &roi->details.amount); - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &amount); } GNUNET_free (account_section); @@ -1702,38 +1459,29 @@ complain_out_not_found (void *cls, return GNUNET_OK; } } -#if FIXME - // TODO fix woi - /* woi3. - qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency ( - TALER_ARL_adb->cls, - &rbiil); + { + struct TALER_AUDITORDB_WireOutInconsistency woi = { + .row_id = roi->details.serial_id, + .destination_account = (char *) roi->details.credit_account_uri, + .diagnostic = "missing justification for outgoing wire transfer", + .expected = zero, + .claimed =roi->details.amount + }; + enum GNUNET_DB_QueryStatus qs; + qs = TALER_ARL_adb->insert_wire_out_inconsistency ( + TALER_ARL_adb->cls, + &woi); if (qs < 0) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - }*/ - TALER_ARL_report ( - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - 0), - TALER_JSON_pack_amount ("amount_wired", - &roi->details.amount), - TALER_JSON_pack_amount ("amount_justified", - &zero), - GNUNET_JSON_pack_data_auto ("wtid", - &roi->details.wtid), - TALER_JSON_pack_time_abs_human ("timestamp", - roi->details.execution_date.abs_time), - GNUNET_JSON_pack_string ("account_section", - wa->ai->section_name), - GNUNET_JSON_pack_string ("diagnostic", - "justification for wire transfer not found"))); -#endif - TALER_ARL_amount_add (&total_bad_amount_out_plus, - &total_bad_amount_out_plus, + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; + } + } + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &roi->details.amount); return GNUNET_OK; } @@ -1768,7 +1516,7 @@ check_exchange_wire_out (struct WireAccount *wa) qs = TALER_ARL_edb->select_wire_out_above_serial_id_by_account ( TALER_ARL_edb->cls, wa->ai->section_name, - wa->pp.last_wire_out_serial_id, + wa->last_wire_out_serial_id, &wire_out_cb, wa); if (0 > qs) @@ -1804,7 +1552,6 @@ history_debit_cb (void *cls, struct WireAccount *wa = cls; struct ReserveOutInfo *roi; size_t slen; - // struct TALER_AUDITORDB_WireFormatInconsistency wfi; wa->dhh = NULL; switch (dhr->http_status) @@ -1840,18 +1587,13 @@ history_debit_cb (void *cls, roi, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) { - char *diagnostic; - - GNUNET_asprintf (&diagnostic, - "duplicate subject hash `%s'", - TALER_B2S (&roi->subject_hash)); - TALER_ARL_amount_add (&total_wire_format_amount, - &total_wire_format_amount, - &dd->amount); -#if FIXME - wfi.diagnostic = diagnostic; - wfi.amount = &dd->amount; - wfi.wire_offset = dd->serial_id; + struct TALER_AUDITORDB_WireFormatInconsistency wfi = { + // fixme: rowid! + .diagnostic = "duplicate subject hash", + .amount = dd->amount, + .wire_offset = dd->serial_id + }; + enum GNUNET_DB_QueryStatus qs; qs = TALER_ARL_adb->insert_wire_format_inconsistency ( TALER_ARL_adb->cls, @@ -1859,18 +1601,14 @@ history_debit_cb (void *cls, if (qs < 0) { + global_qs = qs; GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + commit (qs); + return; } - TALER_ARL_report (report_wire_format_inconsistencies, - GNUNET_JSON_PACK ( - TALER_JSON_pack_amount ("amount", - &dd->amount), - GNUNET_JSON_pack_uint64 ("wire_offset", - dd->serial_id), - GNUNET_JSON_pack_string ("diagnostic", - diagnostic))); -#endif - GNUNET_free (diagnostic); + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_wire_format_amount), + &TALER_ARL_USE_AB (total_wire_format_amount), + &dd->amount); } } check_exchange_wire_out (wa); @@ -1912,8 +1650,8 @@ process_debits (void *cls) struct WireAccount *wa = cls; /* skip accounts where DEBIT is not enabled */ - while ((NULL != wa) && - (GNUNET_NO == wa->ai->debit_enabled)) + while ( (NULL != wa) && + (GNUNET_NO == wa->ai->debit_enabled)) wa = wa->next; if (NULL == wa) { @@ -1991,8 +1729,6 @@ reserve_closed_cb (void *cls, { struct ReserveClosure *rc; struct GNUNET_HashCode key; - // enum GNUNET_DB_QueryStatus qs; - // struct TALER_AUDITORDB_RowInconsistency ri; (void) cls; (void) close_request_row; @@ -2002,34 +1738,21 @@ reserve_closed_cb (void *cls, amount_with_fee, closing_fee)) { -#if FIXME -// TODO fix, something seems not right - ri.row_table = "reserves_closures"; - ri.diagnostic = "closing fee above total amount"; + struct TALER_AUDITORDB_RowInconsistency ri = { + .row_table = "reserves_closures", + .diagnostic = "closing fee above total amount" + }; + enum GNUNET_DB_QueryStatus qs; qs = TALER_ARL_adb->insert_row_inconsistency ( TALER_ARL_adb->cls, &ri); - if (qs < 0) { + global_qs = qs; GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_OK; } - TALER_ARL_report (report_row_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("table", - "reserves_closures"), - GNUNET_JSON_pack_uint64 ("row", - rowid), - GNUNET_JSON_pack_data_auto ("id", - reserve_pub), - TALER_JSON_pack_amount ("amount_with_fee", - amount_with_fee), - TALER_JSON_pack_amount ("closing_fee", - closing_fee), - GNUNET_JSON_pack_string ("diagnostic", - "closing fee above total amount"))); -#endif GNUNET_free (rc); if (TALER_ARL_do_abort ()) return GNUNET_SYSERR; @@ -2079,6 +1802,7 @@ begin_transaction (void) "Failed to initialize auditor database session.\n"); return GNUNET_DB_STATUS_HARD_ERROR; } + global_qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; if (GNUNET_OK != TALER_ARL_adb->start (TALER_ARL_adb->cls)) { @@ -2095,25 +1819,29 @@ begin_transaction (void) } GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_bad_amount_out_plus)); + &TALER_ARL_USE_AB ( + total_bad_amount_out_plus))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_bad_amount_out_minus)); + &TALER_ARL_USE_AB ( + total_bad_amount_out_minus))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_amount_lag)); + &TALER_ARL_USE_AB (total_amount_lag))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_closure_amount_lag)); + &TALER_ARL_USE_AB ( + total_closure_amount_lag))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_wire_format_amount)); + &TALER_ARL_USE_AB ( + total_wire_format_amount))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, &zero)); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_wire_out)); + &TALER_ARL_USE_AB (total_wire_out))); qs = TALER_ARL_adb->get_balance ( TALER_ARL_adb->cls, TALER_ARL_GET_AB (total_drained), @@ -2133,8 +1861,8 @@ begin_transaction (void) &TALER_ARL_USE_AB (total_drained))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &TALER_ARL_USE_AB (total_wire - - out))); + &TALER_ARL_USE_AB (total_wire_out))) + ; had_start_balance = false; break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -2156,7 +1884,7 @@ begin_transaction (void) wa->qsx = TALER_ARL_adb->get_auditor_progress ( TALER_ARL_adb->cls, wa->label_wire_out_serial_id, - &wa->pp.last_wire_out_serial_id, + &wa->last_wire_out_serial_id, wa->label_wire_off_out, &wa->wire_off_out, NULL); @@ -2165,7 +1893,7 @@ begin_transaction (void) GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == wa->qsx); return GNUNET_DB_STATUS_HARD_ERROR; } - wa->start_pp = wa->pp; + wa->start_wire_out_serial_id = wa->last_wire_out_serial_id; } qsx_gwap = TALER_ARL_adb->get_auditor_progress ( TALER_ARL_adb->cls, @@ -2210,7 +1938,7 @@ begin_transaction (void) return GNUNET_DB_STATUS_HARD_ERROR; } } - begin_credit_audit (); + begin_debit_audit (); return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; } @@ -2271,8 +1999,6 @@ db_notify (void *cls, global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); } - - } @@ -2347,19 +2073,23 @@ run (void *cls, GNUNET_NO); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_bad_amount_out_plus)); + &TALER_ARL_USE_AB ( + total_bad_amount_out_plus))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_bad_amount_out_minus)); + &TALER_ARL_USE_AB ( + total_bad_amount_out_minus))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_amount_lag)); + &TALER_ARL_USE_AB (total_amount_lag))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_closure_amount_lag)); + &TALER_ARL_USE_AB ( + total_closure_amount_lag))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, - &total_wire_format_amount)); + &TALER_ARL_USE_AB ( + total_wire_format_amount))); GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (TALER_ARL_currency, &zero)); @@ -2460,4 +2190,4 @@ main (int argc, } -/* end of taler-helper-auditor-wire.c */ +/* end of taler-helper-auditor-wire-debit.c */ diff --git a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql @@ -1,31 +1,31 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - --- TODO: The constraints of operation are just for testing - -CREATE TABLE auditor_amount_arithmetic_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - -- TODO: correct constraintcheck, currently wrong - --operation BYTEA NOT NULL CHECK (LENGTH(operation)=16), - operation TEXT NOT NULL PRIMARY KEY, - exchange_amount taler_amount, - auditor_amount taler_amount, - profitable BOOLEAN, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_amount_arithmetic_inconsistency - IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts'; +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +-- TODO: The constraints of operation are just for testing + +CREATE TABLE auditor_amount_arithmetic_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + -- TODO: correct constraintcheck, currently wrong + --operation BYTEA NOT NULL CHECK (LENGTH(operation)=16), + operation TEXT NOT NULL PRIMARY KEY, + exchange_amount taler_amount, + auditor_amount taler_amount, + profitable BOOLEAN, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_amount_arithmetic_inconsistency + IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts'; diff --git a/src/auditordb/0002-auditor_bad_sig_losses.sql b/src/auditordb/0002-auditor_bad_sig_losses.sql @@ -1,28 +1,28 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_bad_sig_losses -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - operation TEXT, - loss taler_amount, - operation_specific_pub BYTEA NOT NULL CHECK (LENGTH(operation_specific_pub)=32), - suppressed BOOLEAN NOT NULL DEFAULT FALSE, - PRIMARY KEY (operation, operation_specific_pub) -); -COMMENT ON TABLE auditor_bad_sig_losses - IS 'Report a (serious) inconsistency with losses due to bad signatures'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_bad_sig_losses +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + operation TEXT, + loss taler_amount, + operation_specific_pub BYTEA NOT NULL CHECK (LENGTH(operation_specific_pub)=32), + suppressed BOOLEAN NOT NULL DEFAULT FALSE, + PRIMARY KEY (operation, operation_specific_pub) +); +COMMENT ON TABLE auditor_bad_sig_losses + IS 'Report a (serious) inconsistency with losses due to bad signatures'; diff --git a/src/auditordb/0002-auditor_closure_lags.sql b/src/auditordb/0002-auditor_closure_lags.sql @@ -1,28 +1,28 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_closure_lags -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount taler_amount, - deadline BIGINT, - wtid BYTEA, - account BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_closure_lags - IS 'Report closure lags.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_closure_lags +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + amount taler_amount, + deadline BIGINT, + wtid BYTEA, + account BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_closure_lags + IS 'Report closure lags.'; diff --git a/src/auditordb/0002-auditor_coin_inconsistency.sql b/src/auditordb/0002-auditor_coin_inconsistency.sql @@ -1,30 +1,30 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_coin_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - operation TEXT NOT NULL, - exchange_amount taler_amount, - auditor_amount taler_amount, - coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32), - profitable BOOLEAN, - suppressed BOOLEAN NOT NULL DEFAULT FALSE, - PRIMARY KEY (operation, coin_pub) -); -COMMENT ON TABLE auditor_coin_inconsistency - IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_coin_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + operation TEXT NOT NULL, + exchange_amount taler_amount, + auditor_amount taler_amount, + coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32), + profitable BOOLEAN, + suppressed BOOLEAN NOT NULL DEFAULT FALSE, + PRIMARY KEY (operation, coin_pub) +); +COMMENT ON TABLE auditor_coin_inconsistency + IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts'; diff --git a/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql b/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_denomination_key_validity_withdraw_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - execution_date BIGINT, - reserve_pub BYTEA, - denompub_h BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_denomination_key_validity_withdraw_inconsistency - IS 'Report a (serious) denomination key validity withdraw inconsistency in the exchange''s database'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_denomination_key_validity_withdraw_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + execution_date BIGINT, + reserve_pub BYTEA, + denompub_h BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_denomination_key_validity_withdraw_inconsistency + IS 'Report a (serious) denomination key validity withdraw inconsistency in the exchange''s database'; diff --git a/src/auditordb/0002-auditor_denominations_without_sigs.sql b/src/auditordb/0002-auditor_denominations_without_sigs.sql @@ -1,28 +1,28 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_denominations_without_sigs -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - denompub_h BYTEA PRIMARY KEY, - value taler_amount, - start_time BIGINT, - end_time BIGINT, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_denominations_without_sigs - IS 'Report encountered denomination that auditor is not auditing.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_denominations_without_sigs +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + denompub_h BYTEA PRIMARY KEY, + value taler_amount, + start_time BIGINT, + end_time BIGINT, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_denominations_without_sigs + IS 'Report encountered denomination that auditor is not auditing.'; diff --git a/src/auditordb/0002-auditor_emergency.sql b/src/auditordb/0002-auditor_emergency.sql @@ -1,31 +1,31 @@ - - --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_emergency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - denompub_h BYTEA CHECK (LENGTH(denompub_h)=64), - denom_risk taler_amount, - denom_loss taler_amount, - deposit_start BIGINT, - deposit_end BIGINT, - value taler_amount -); -COMMENT ON TABLE auditor_emergency - IS 'Report an emergency denomination.'; -\ No newline at end of file + + +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_emergency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + denompub_h BYTEA CHECK (LENGTH(denompub_h)=64), + denom_risk taler_amount, + denom_loss taler_amount, + deposit_start BIGINT, + deposit_end BIGINT, + value taler_amount +); +COMMENT ON TABLE auditor_emergency + IS 'Report an emergency denomination.'; diff --git a/src/auditordb/0002-auditor_emergency_by_count.sql b/src/auditordb/0002-auditor_emergency_by_count.sql @@ -1,31 +1,31 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_emergency_by_count -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - denompub_h BYTEA, - num_issued BIGINT, - num_known BIGINT, - risk taler_amount, - start BIGINT, - deposit_end BIGINT, - value taler_amount, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_emergency_by_count - IS 'Report an emergency denomination.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_emergency_by_count +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + denompub_h BYTEA, + num_issued BIGINT, + num_known BIGINT, + risk taler_amount, + start BIGINT, + deposit_end BIGINT, + value taler_amount, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_emergency_by_count + IS 'Report an emergency denomination.'; diff --git a/src/auditordb/0002-auditor_fee_time_inconsistency.sql b/src/auditordb/0002-auditor_fee_time_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_fee_time_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - type BYTEA, - time BIGINT, - diagnostic BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_fee_time_inconsistency - IS 'Report a (serious) fee time inconsistency in the exchange''s database'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_fee_time_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + type BYTEA, + time BIGINT, + diagnostic BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_fee_time_inconsistency + IS 'Report a (serious) fee time inconsistency in the exchange''s database'; diff --git a/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql b/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_misattribution_in_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount taler_amount, - bank_row BIGINT, - reserve_pub BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_misattribution_in_inconsistency - IS 'Report wire transfer that was smaller than it should have been.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_misattribution_in_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + amount taler_amount, + bank_row BIGINT, + reserve_pub BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_misattribution_in_inconsistency + IS 'Report wire transfer that was smaller than it should have been.'; diff --git a/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql b/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_purse_not_closed_inconsistencies -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE , - purse_pub BYTEA PRIMARY KEY, - amount taler_amount, - expiration_date BIGINT, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_purse_not_closed_inconsistencies - IS 'Report expired purses'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_purse_not_closed_inconsistencies +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE , + purse_pub BYTEA PRIMARY KEY, + amount taler_amount, + expiration_date BIGINT, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_purse_not_closed_inconsistencies + IS 'Report expired purses'; diff --git a/src/auditordb/0002-auditor_refreshes_hanging.sql b/src/auditordb/0002-auditor_refreshes_hanging.sql @@ -1,26 +1,26 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_refreshes_hanging -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - amount taler_amount, - coin_pub BYTEA PRIMARY KEY, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_refreshes_hanging - IS 'Report a hanging refresh.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_refreshes_hanging +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + amount taler_amount, + coin_pub BYTEA PRIMARY KEY, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_refreshes_hanging + IS 'Report a hanging refresh.'; diff --git a/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql b/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_reserve_balance_insufficient_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32), - inconsistency_gain BOOLEAN, - inconsistency_amount taler_amount, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_reserve_balance_insufficient_inconsistency - IS 'Report a (serious) balance insufficiency in the exchange''s database'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_reserve_balance_insufficient_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32), + inconsistency_gain BOOLEAN, + inconsistency_amount taler_amount, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_reserve_balance_insufficient_inconsistency + IS 'Report a (serious) balance insufficiency in the exchange''s database'; diff --git a/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql b/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_reserve_balance_summary_wrong_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - reserve_pub BYTEA, - exchange_amount taler_amount, - auditor_amount taler_amount, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_reserve_balance_summary_wrong_inconsistency - IS 'Report a (serious) reserve balance insufficiency.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_reserve_balance_summary_wrong_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + reserve_pub BYTEA, + exchange_amount taler_amount, + auditor_amount taler_amount, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_reserve_balance_summary_wrong_inconsistency + IS 'Report a (serious) reserve balance insufficiency.'; diff --git a/src/auditordb/0002-auditor_reserve_in_inconsistency.sql b/src/auditordb/0002-auditor_reserve_in_inconsistency.sql @@ -1,30 +1,30 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_reserve_in_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount_exchange_expected taler_amount, - amount_wired taler_amount, - reserve_pub BYTEA, - timestamp BIGINT, - account BYTEA, - diagnostic BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_reserve_in_inconsistency - IS 'Report an incoming wire transfer claimed by exchange not found.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_reserve_in_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + amount_exchange_expected taler_amount, + amount_wired taler_amount, + reserve_pub BYTEA, + timestamp BIGINT, + account BYTEA, + diagnostic BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_reserve_in_inconsistency + IS 'Report an incoming wire transfer claimed by exchange not found.'; diff --git a/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql b/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql @@ -1,28 +1,28 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_reserve_not_closed_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE , - reserve_pub BYTEA PRIMARY KEY, - balance taler_amount, - expiration_time BIGINT, - diagnostic BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_reserve_not_closed_inconsistency - IS 'Report a (serious) reserve balance insufficiency.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_reserve_not_closed_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE , + reserve_pub BYTEA PRIMARY KEY, + balance taler_amount, + expiration_time BIGINT, + diagnostic BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_reserve_not_closed_inconsistency + IS 'Report a (serious) reserve balance insufficiency.'; diff --git a/src/auditordb/0002-auditor_row_inconsistency.sql b/src/auditordb/0002-auditor_row_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_row_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - row_table TEXT NOT NULL, - diagnostic TEXT NOT NULL, - problem_row_id INT8 NOT NULL, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_row_inconsistency - IS 'Report a (serious) row inconsistency in the exchange''s database'; +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_row_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + row_table TEXT NOT NULL, + diagnostic TEXT NOT NULL, + problem_row_id INT8 NOT NULL, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_row_inconsistency + IS 'Report a (serious) row inconsistency in the exchange''s database'; diff --git a/src/auditordb/0002-auditor_row_minor_inconsistencies.sql b/src/auditordb/0002-auditor_row_minor_inconsistencies.sql @@ -1,26 +1,26 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_row_minor_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - row_table BYTEA, - diagnostic BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_row_minor_inconsistency - IS 'Report a (serious) row inconsistency in the exchange''s database.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_row_minor_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + row_table BYTEA, + diagnostic BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_row_minor_inconsistency + IS 'Report a (serious) row inconsistency in the exchange''s database.'; diff --git a/src/auditordb/0002-auditor_wire_format_inconsistency.sql b/src/auditordb/0002-auditor_wire_format_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_wire_format_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount taler_amount, - wire_offset BIGINT, - diagnostic BYTEA, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_wire_format_inconsistency - IS 'Report a (serious) format inconsistency.'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_wire_format_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + amount taler_amount, + wire_offset BIGINT, + diagnostic BYTEA, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_wire_format_inconsistency + IS 'Report a (serious) format inconsistency.'; diff --git a/src/auditordb/0002-auditor_wire_out_inconsistency.sql b/src/auditordb/0002-auditor_wire_out_inconsistency.sql @@ -1,27 +1,27 @@ --- --- This file is part of TALER --- Copyright (C) 2014--2024 Taler Systems SA --- --- TALER is free software; you can redistribute it and/or modify it under the --- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 3, or (at your option) any later version. --- --- TALER is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR --- A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License along with --- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --- - -SET search_path TO auditor; -CREATE TABLE IF NOT EXISTS auditor_wire_out_inconsistency -( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - destination_account TEXT NOT NULL, - expected taler_amount, - claimed taler_amount, - suppressed BOOLEAN NOT NULL DEFAULT FALSE -); -COMMENT ON TABLE auditor_wire_out_inconsistency - IS 'Report a (serious) wire inconsistency in the exchange''s database'; -\ No newline at end of file +-- +-- This file is part of TALER +-- Copyright (C) 2014--2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +-- A PARTICULAR PURPOSE. See the GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +SET search_path TO auditor; +CREATE TABLE IF NOT EXISTS auditor_wire_out_inconsistency +( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + destination_account TEXT NOT NULL, + expected taler_amount, + claimed taler_amount, + suppressed BOOLEAN NOT NULL DEFAULT FALSE +); +COMMENT ON TABLE auditor_wire_out_inconsistency + IS 'Report a (serious) wire inconsistency in the exchange''s database'; diff --git a/src/auditordb/pg_get_denomination_pending.c b/src/auditordb/pg_get_denomination_pending.c @@ -69,22 +69,16 @@ denomination_pending_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { uint64_t serial_id; - struct TALER_AUDITORDB_DenominationPending dc; - struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &dc.denom_pub_hash), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_balance", &dc.denom_balance), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_loss", &dc.denom_loss), - GNUNET_PQ_result_spec_int64 ("num_issued", &dc.num_issued), + GNUNET_PQ_result_spec_uint64 ("num_issued", &dc.num_issued), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_risk", &dc.denom_risk), TALER_PQ_RESULT_SPEC_AMOUNT ("recoup_loss", &dc.recoup_loss), - - GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; @@ -98,9 +92,7 @@ denomination_pending_cb (void *cls, dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - dcc->qs = i + 1; - rval = dcc->cb (dcc->cb_cls, serial_id, &dc); diff --git a/src/auditordb/pg_get_emergency_by_count.c b/src/auditordb/pg_get_emergency_by_count.c @@ -71,20 +71,16 @@ emergency_by_count_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { uint64_t serial_id; - struct TALER_AUDITORDB_EmergenciesByCount dc; - struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), GNUNET_PQ_result_spec_auto_from_type ("denompub_h", &dc.denompub_h), - GNUNET_PQ_result_spec_int64 ("num_issued", &dc.num_issued), - GNUNET_PQ_result_spec_int64 ("num_known", &dc.num_known), + GNUNET_PQ_result_spec_uint64 ("num_issued", &dc.num_issued), + GNUNET_PQ_result_spec_uint64 ("num_known", &dc.num_known), TALER_PQ_RESULT_SPEC_AMOUNT ("risk", &dc.risk), GNUNET_PQ_result_spec_absolute_time ("start", &dc.start), GNUNET_PQ_result_spec_absolute_time ("deposit_end", &dc.deposit_end), TALER_PQ_RESULT_SPEC_AMOUNT ("value", &dc.value), - GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; @@ -98,9 +94,7 @@ emergency_by_count_cb (void *cls, dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - dcc->qs = i + 1; - rval = dcc->cb (dcc->cb_cls, serial_id, &dc); @@ -120,9 +114,7 @@ TAH_PG_get_emergency_by_count ( TALER_AUDITORDB_EmergenciesByCountCallback cb, void *cb_cls) { - uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); - struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), @@ -172,15 +164,16 @@ TAH_PG_get_emergency_by_count ( " LIMIT $3" ); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - (limit > 0) ? + (limit > 0) + ? "auditor_emergency_by_count_get_asc" - : "auditor_emergency_by_count_get_desc", + : + "auditor_emergency_by_count_get_desc", params, &emergency_by_count_cb, &dcc); - if (qs > 0) return dcc.qs; GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); return qs; -} -\ No newline at end of file +} diff --git a/src/auditordb/pg_get_misattribution_in_inconsistency.c b/src/auditordb/pg_get_misattribution_in_inconsistency.c @@ -69,19 +69,13 @@ misattribution_in_inconsistency_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { uint64_t serial_id; - struct TALER_AUDITORDB_MisattributionInInconsistency dc; - struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - - TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount), - GNUNET_PQ_result_spec_int64 ("bank_row", &dc.bank_row), - GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), - GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), - - + TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount), + GNUNET_PQ_result_spec_uint64 ("bank_row", &dc.bank_row), + GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), + GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; @@ -95,9 +89,7 @@ misattribution_in_inconsistency_cb (void *cls, dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - dcc->qs = i + 1; - rval = dcc->cb (dcc->cb_cls, serial_id, &dc); @@ -169,7 +161,8 @@ TAH_PG_get_misattribution_in_inconsistency ( : "auditor_misattribution_in_inconsistency_get_desc", params, - &misattribution_in_inconsistency_cb, + &misattribution_in_inconsistency_cb + , &dcc); if (qs > 0) diff --git a/src/auditordb/pg_get_purses.c b/src/auditordb/pg_get_purses.c @@ -13,14 +13,11 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include "taler_error_codes.h" #include "taler_dbevents.h" #include "taler_pq_lib.h" #include "pg_helper.h" - #include "pg_get_purses.h" @@ -68,20 +65,18 @@ purses_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { - struct TALER_AUDITORDB_Purses dc; - struct GNUNET_PQ_ResultSpec rs[] = { - - GNUNET_PQ_result_spec_int64 ("auditor_purses_rowid", - &dc.auditor_purses_rowid), - GNUNET_PQ_result_spec_auto_from_type ("purse_pub", &dc.purse_pub), - TALER_PQ_RESULT_SPEC_AMOUNT ("balance", &dc.balance), - TALER_PQ_RESULT_SPEC_AMOUNT ("target", &dc.target), + GNUNET_PQ_result_spec_uint64 ("auditor_purses_rowid", + &dc.auditor_purses_rowid), + GNUNET_PQ_result_spec_auto_from_type ("purse_pub", + &dc.purse_pub), + TALER_PQ_RESULT_SPEC_AMOUNT ("balance", + &dc.balance), + TALER_PQ_RESULT_SPEC_AMOUNT ("target", + &dc.target), GNUNET_PQ_result_spec_absolute_time ("expiration_date", &dc.expiration_date), - - GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; @@ -95,9 +90,7 @@ purses_cb (void *cls, dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - dcc->qs = i + 1; - rval = dcc->cb (dcc->cb_cls, dc.auditor_purses_rowid, &dc); @@ -117,9 +110,7 @@ TAH_PG_get_purses ( TALER_AUDITORDB_PursesCallback cb, void *cb_cls) { - uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); - struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), diff --git a/src/auditordb/pg_get_reserves.c b/src/auditordb/pg_get_reserves.c @@ -13,14 +13,11 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include "taler_error_codes.h" #include "taler_dbevents.h" #include "taler_pq_lib.h" #include "pg_helper.h" - #include "pg_get_reserves.h" @@ -68,13 +65,10 @@ reserves_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { - struct TALER_AUDITORDB_Reserves dc; - struct GNUNET_PQ_ResultSpec rs[] = { - - GNUNET_PQ_result_spec_int64 ("auditor_reserves_rowid", - &dc.auditor_reserves_rowid), + GNUNET_PQ_result_spec_uint64 ("auditor_reserves_rowid", + &dc.auditor_reserves_rowid), GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_balance", &dc.reserve_balance), TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_loss", &dc.reserve_loss), @@ -88,8 +82,6 @@ reserves_cb (void *cls, GNUNET_PQ_result_spec_absolute_time ("expiration_date", &dc.expiration_date), GNUNET_PQ_result_spec_string ("origin_account", &dc.origin_account), - - GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; @@ -103,9 +95,7 @@ reserves_cb (void *cls, dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } - dcc->qs = i + 1; - rval = dcc->cb (dcc->cb_cls, dc.auditor_reserves_rowid, &dc); @@ -125,9 +115,7 @@ TAH_PG_get_reserves ( TALER_AUDITORDB_ReservesCallback cb, void *cb_cls) { - uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); - struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&offset), @@ -186,7 +174,6 @@ TAH_PG_get_reserves ( params, &reserves_cb, &dcc); - if (qs > 0) return dcc.qs; GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); diff --git a/src/auditordb/pg_insert_denomination_pending.c b/src/auditordb/pg_insert_denomination_pending.c @@ -28,15 +28,12 @@ TAH_PG_insert_denomination_pending ( { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (&dc->denom_pub_hash), TALER_PQ_query_param_amount (pg->conn, &dc->denom_balance), TALER_PQ_query_param_amount (pg->conn, &dc->denom_loss), - GNUNET_PQ_query_param_int64 (&dc->num_issued), + GNUNET_PQ_query_param_uint64 (&dc->num_issued), TALER_PQ_query_param_amount (pg->conn, &dc->denom_risk), TALER_PQ_query_param_amount (pg->conn, &dc->recoup_loss), - - GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_emergency_by_count.c b/src/auditordb/pg_insert_emergency_by_count.c @@ -13,13 +13,9 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" - - #include "pg_insert_emergency_by_count.h" enum GNUNET_DB_QueryStatus @@ -29,15 +25,13 @@ TAH_PG_insert_emergency_by_count ( { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (&dc->denompub_h), - GNUNET_PQ_query_param_int64 (&dc->num_issued), - GNUNET_PQ_query_param_int64 (&dc->num_known), + GNUNET_PQ_query_param_uint64 (&dc->num_issued), + GNUNET_PQ_query_param_uint64 (&dc->num_known), TALER_PQ_query_param_amount (pg->conn, &dc->risk), GNUNET_PQ_query_param_absolute_time (&dc->start), GNUNET_PQ_query_param_absolute_time (&dc->deposit_end), TALER_PQ_query_param_amount (pg->conn, &dc->value), - GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_misattribution_in_inconsistency.c b/src/auditordb/pg_insert_misattribution_in_inconsistency.c @@ -13,12 +13,9 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" - #include "pg_insert_misattribution_in_inconsistency.h" enum GNUNET_DB_QueryStatus @@ -28,19 +25,16 @@ TAH_PG_insert_misattribution_in_inconsistency ( { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - TALER_PQ_query_param_amount (pg->conn, &dc->amount), - GNUNET_PQ_query_param_int64 (&dc->bank_row), + GNUNET_PQ_query_param_uint64 (&dc->bank_row), GNUNET_PQ_query_param_auto_from_type (&dc->reserve_pub), - - GNUNET_PQ_query_param_end }; PREPARE (pg, "auditor_misattribution_in_inconsistency_insert", "INSERT INTO auditor_misattribution_in_inconsistency " - "( row_id," + "(row_id," " amount," " bank_row," " reserve_pub" diff --git a/src/auditordb/pg_insert_purses.c b/src/auditordb/pg_insert_purses.c @@ -13,12 +13,9 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" - #include "pg_insert_purses.h" enum GNUNET_DB_QueryStatus @@ -28,14 +25,11 @@ TAH_PG_insert_purses ( { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { - - GNUNET_PQ_query_param_int64 (&dc->auditor_purses_rowid), + GNUNET_PQ_query_param_uint64 (&dc->auditor_purses_rowid), GNUNET_PQ_query_param_auto_from_type (&dc->purse_pub), TALER_PQ_query_param_amount (pg->conn, &dc->balance), TALER_PQ_query_param_amount (pg->conn, &dc->target), GNUNET_PQ_query_param_absolute_time (&dc->expiration_date), - - GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_row_inconsistency.c b/src/auditordb/pg_insert_row_inconsistency.c @@ -25,11 +25,10 @@ TAH_PG_insert_row_inconsistency ( const struct TALER_AUDITORDB_RowInconsistency *dc) { struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_string (dc->row_table), GNUNET_PQ_query_param_string (dc->diagnostic), + GNUNET_PQ_query_param_uint64 (&dc->row_id), GNUNET_PQ_query_param_end }; @@ -38,8 +37,8 @@ TAH_PG_insert_row_inconsistency ( "INSERT INTO auditor_row_inconsistency " "(row_table" ",diagnostic" - ") VALUES ($1,$2);"); - + ",problem_row_id" + ") VALUES ($1,$2,$3);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_deposit_confirmation_insert", params); diff --git a/src/auditordb/test_auditordb_checkpoints.c b/src/auditordb/test_auditordb_checkpoints.c @@ -21,7 +21,6 @@ #include "platform.h" #include <gnunet/gnunet_common.h> #include <gnunet/gnunet_db_lib.h> -#include "taler_auditordb_lib.h" #include "taler_auditordb_plugin.h" /** @@ -33,24 +32,24 @@ * Report line of error if @a cond is true, and jump to label "drop". */ #define FAILIF(cond) \ - do { \ - if (! (cond)) { break;} \ - GNUNET_break (0); \ - goto drop; \ - } while (0) + do { \ + if (! (cond)) { break;} \ + GNUNET_break (0); \ + goto drop; \ + } while (0) /** * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \ - sizeof (*ptr)) + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \ + sizeof (*ptr)) /** * Initializes @a ptr with zeros. */ #define ZR_BLK(ptr) \ - memset (ptr, 0, sizeof (*ptr)) + memset (ptr, 0, sizeof (*ptr)) /** diff --git a/src/exchange/exchange.conf b/src/exchange/exchange.conf @@ -46,6 +46,9 @@ SERVE = tcp UNIXPATH = ${TALER_RUNTIME_DIR}/exchange-httpd/exchange-http.sock UNIXPATH_MODE = 660 +# Linear component for the STEFAN curve +STEFAN_LIN = 0.0 + # HTTP port the exchange listens to PORT = 8081 diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c @@ -1247,7 +1247,8 @@ run (void *cls, else shard_size = (uint32_t) ass; if (GNUNET_OK != - TALER_KYCLOGIC_kyc_init (cfg)) + TALER_KYCLOGIC_kyc_init (cfg, + cfgfile)) { cfg = NULL; global_ret = EXIT_NOTCONFIGURED; diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c @@ -156,6 +156,16 @@ struct TALER_AttributeEncryptionKeyP TEH_attribute_key; struct TALER_EXCHANGEDB_Plugin *TEH_plugin; /** + * Maximum amount per individual transaction. Invalid amount if unlimited. + */ +struct TALER_Amount TEH_transaction_limit; + +/** + * Maximum amount per refund. Invalid amount if unlimited. + */ +struct TALER_Amount TEH_refund_limit; + +/** * Absolute STEFAN parameter. */ struct TALER_Amount TEH_stefan_abs; @@ -2110,10 +2120,11 @@ handle_mhd_request (void *cls, * Load configuration parameters for the exchange * server into the corresponding global variables. * + * @param cfg_fn name of our configuration file * @return #GNUNET_OK on success */ static enum GNUNET_GenericReturnValue -exchange_serve_process_config (void) +exchange_serve_process_config (const char *cfg_fn) { TEH_enable_kyc = GNUNET_CONFIGURATION_get_value_yesno ( @@ -2127,8 +2138,10 @@ exchange_serve_process_config (void) return GNUNET_SYSERR; } if (GNUNET_OK != - TALER_KYCLOGIC_kyc_init (TEH_cfg)) + TALER_KYCLOGIC_kyc_init (TEH_cfg, + cfg_fn)) { + GNUNET_break (0); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -2204,33 +2217,57 @@ exchange_serve_process_config (void) } /* currency parser must provide default spec for main currency */ GNUNET_assert (NULL != TEH_cspec); - if (GNUNET_OK != + if (GNUNET_SYSERR == + TALER_config_get_amount (TEH_cfg, + "exchange", + "TRANSACTION_LIMIT", + &TEH_transaction_limit)) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + if (GNUNET_SYSERR == + TALER_config_get_amount (TEH_cfg, + "exchange", + "REFUND_LIMIT", + &TEH_refund_limit)) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (TEH_currency, + &TEH_stefan_abs)); + if (GNUNET_SYSERR == TALER_config_get_amount (TEH_cfg, "exchange", "STEFAN_ABS", &TEH_stefan_abs)) { - GNUNET_assert (GNUNET_OK == - TALER_amount_set_zero (TEH_currency, - &TEH_stefan_abs)); + GNUNET_break (0); + return GNUNET_SYSERR; } - if (GNUNET_OK != + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (TEH_currency, + &TEH_stefan_log)); + if (GNUNET_SYSERR == TALER_config_get_amount (TEH_cfg, "exchange", "STEFAN_LOG", &TEH_stefan_log)) { - GNUNET_assert (GNUNET_OK == - TALER_amount_set_zero (TEH_currency, - &TEH_stefan_log)); + GNUNET_break (0); + return GNUNET_SYSERR; } - if (GNUNET_OK != + TEH_stefan_lin = 0.0f; + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_float (TEH_cfg, "exchange", "STEFAN_LIN", &TEH_stefan_lin)) { - TEH_stefan_lin = 0.0f; + GNUNET_break (0); + return GNUNET_SYSERR; } if (GNUNET_OK != @@ -2643,7 +2680,7 @@ run (void *cls, TEH_cfg = config; if (GNUNET_OK != - exchange_serve_process_config ()) + exchange_serve_process_config (cfgfile)) { global_ret = EXIT_NOTCONFIGURED; GNUNET_SCHEDULER_shutdown (); diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h @@ -98,6 +98,16 @@ extern struct TALER_AttributeEncryptionKeyP TEH_attribute_key; extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin; /** + * Maximum amount per individual transaction. Invalid amount if unlimited. + */ +extern struct TALER_Amount TEH_transaction_limit; + +/** + * Maximum amount per refund. Invalid amount if unlimited. + */ +extern struct TALER_Amount TEH_refund_limit; + +/** * Absolute STEFAN parameter. */ extern struct TALER_Amount TEH_stefan_abs; diff --git a/src/exchange/taler-exchange-httpd_coins_get.c b/src/exchange/taler-exchange-httpd_coins_get.c @@ -40,7 +40,6 @@ add_response_headers (void *cls, struct MHD_Response *response) { (void) cls; - TALER_MHD_add_global_headers (response); GNUNET_break (MHD_YES == MHD_add_response_header (response, MHD_HTTP_HEADER_CACHE_CONTROL, diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c @@ -2413,6 +2413,18 @@ create_krd (struct TEH_KeyStateHandle *ksh, GNUNET_JSON_pack_object_steal ( "currency_specification", TALER_CONFIG_currency_specs_to_json (TEH_cspec)), + GNUNET_JSON_pack_allow_null ( + TALER_JSON_pack_amount ("transaction_amount_limit", + GNUNET_OK == + TALER_amount_is_valid (&TEH_transaction_limit) + ? &TEH_transaction_limit + : NULL)), + GNUNET_JSON_pack_allow_null ( + TALER_JSON_pack_amount ("refund_amount_limit", + GNUNET_OK == + TALER_amount_is_valid (&TEH_refund_limit) + ? &TEH_refund_limit + : NULL)), TALER_JSON_pack_amount ("stefan_abs", &TEH_stefan_abs), TALER_JSON_pack_amount ("stefan_log", diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c @@ -186,7 +186,6 @@ add_response_headers (void *cls, struct MHD_Response *response) { (void) cls; - TALER_MHD_add_global_headers (response); GNUNET_break (MHD_YES == MHD_add_response_header (response, MHD_HTTP_HEADER_CACHE_CONTROL, diff --git a/src/exchange/taler-exchange-httpd_reserves_history.c b/src/exchange/taler-exchange-httpd_reserves_history.c @@ -339,7 +339,6 @@ add_response_headers (void *cls, struct MHD_Response *response) { (void) cls; - TALER_MHD_add_global_headers (response); GNUNET_break (MHD_YES == MHD_add_response_header (response, MHD_HTTP_HEADER_CACHE_CONTROL, diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h @@ -212,7 +212,8 @@ struct TALER_AUDITORDB_Generic_Update */ struct TALER_AUDITORDB_AmountArithmeticInconsistency { - unsigned int row_id; + // FIXME: which row? + uint64_t row_id; char *operation; struct TALER_Amount exchange_amount; struct TALER_Amount auditor_amount; @@ -224,7 +225,7 @@ struct TALER_AUDITORDB_AmountArithmeticInconsistency */ struct TALER_AUDITORDB_CoinInconsistency { - unsigned int row_id; + uint64_t row_id; char *operation; struct TALER_Amount exchange_amount; struct TALER_Amount auditor_amount; @@ -237,7 +238,7 @@ struct TALER_AUDITORDB_CoinInconsistency */ struct TALER_AUDITORDB_RowInconsistency { - unsigned int row_id; + uint64_t row_id; char *row_table; char *diagnostic; bool suppressed; @@ -248,7 +249,7 @@ struct TALER_AUDITORDB_RowInconsistency */ struct TALER_AUDITORDB_BadSigLosses { - unsigned int row_id; + uint64_t row_id; char *operation; struct TALER_Amount loss; struct GNUNET_CRYPTO_EddsaPublicKey operation_specific_pub; @@ -259,10 +260,10 @@ struct TALER_AUDITORDB_BadSigLosses */ struct TALER_AUDITORDB_ClosureLags { - unsigned int row_id; + uint64_t row_id; struct TALER_Amount amount; struct GNUNET_TIME_Absolute deadline; - struct GNUNET_HashCode wtid; + struct TALER_WireTransferIdentifierRawP wtid; char *account; }; @@ -272,7 +273,7 @@ struct TALER_AUDITORDB_ClosureLags */ struct TALER_AUDITORDB_Emergency { - unsigned int row_id; + uint64_t row_id; struct TALER_DenominationHashP denompub_h; struct TALER_Amount denom_risk; struct TALER_Amount denom_loss; @@ -286,10 +287,10 @@ struct TALER_AUDITORDB_Emergency */ struct TALER_AUDITORDB_EmergenciesByCount { - unsigned int row_id; + uint64_t row_id; struct TALER_DenominationHashP denompub_h; - int64_t num_issued; - int64_t num_known; + uint64_t num_issued; + uint64_t num_known; struct TALER_Amount risk; struct GNUNET_TIME_Absolute start; struct GNUNET_TIME_Absolute deposit_end; @@ -301,9 +302,9 @@ struct TALER_AUDITORDB_EmergenciesByCount */ struct TALER_AUDITORDB_Progress { - unsigned int row_id; + uint64_t row_id; char *progress_key; - int64_t progress_offset; + uint64_t progress_offset; }; /** @@ -311,7 +312,7 @@ struct TALER_AUDITORDB_Progress */ struct TALER_AUDITORDB_RefreshesHanging { - unsigned int row_id; + uint64_t row_id; struct TALER_Amount amount; struct GNUNET_CRYPTO_EddsaPublicKey coin_pub; }; @@ -321,7 +322,7 @@ struct TALER_AUDITORDB_RefreshesHanging */ struct TALER_AUDITORDB_FeeTimeInconsistency { - unsigned int row_id; + uint64_t row_id; char *type; struct GNUNET_TIME_Absolute time; char *diagnostic; @@ -332,7 +333,7 @@ struct TALER_AUDITORDB_FeeTimeInconsistency */ struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency { - unsigned int row_id; + uint64_t row_id; struct GNUNET_TIME_Absolute execution_date; struct TALER_ReservePublicKeyP reserve_pub; struct TALER_DenominationHashP denompub_h; @@ -343,7 +344,7 @@ struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency */ struct TALER_AUDITORDB_PurseNotClosedInconsistencies { - unsigned int row_id; + uint64_t row_id; struct GNUNET_CRYPTO_EddsaPublicKey purse_pub; struct TALER_Amount amount; struct GNUNET_TIME_Absolute expiration_date; @@ -354,7 +355,7 @@ struct TALER_AUDITORDB_PurseNotClosedInconsistencies */ struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency { - unsigned int row_id; + uint64_t row_id; struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; bool inconsistency_gain; struct TALER_Amount inconsistency_amount; @@ -365,7 +366,7 @@ struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency */ struct TALER_AUDITORDB_ReserveInInconsistency { - unsigned int row_id; + uint64_t row_id; struct TALER_Amount amount_exchange_expected; struct TALER_Amount amount_wired; struct TALER_ReservePublicKeyP reserve_pub; @@ -381,7 +382,7 @@ struct TALER_AUDITORDB_ReserveInInconsistency */ struct TALER_AUDITORDB_Balances { - unsigned int row_id; + uint64_t row_id; char *balance_key; struct TALER_Amount balance_value; bool suppressed; @@ -678,7 +679,7 @@ struct TALER_AUDITORDB_DenominationCirculationData struct TALER_AUDITORDB_DenominationsWithoutSigs { - unsigned int row_id; + uint64_t row_id; struct TALER_DenominationHashP denompub_h; struct TALER_Amount value; struct GNUNET_TIME_Absolute start_time; @@ -689,9 +690,9 @@ struct TALER_AUDITORDB_DenominationsWithoutSigs struct TALER_AUDITORDB_MisattributionInInconsistency { - unsigned int row_id; + uint64_t row_id; struct TALER_Amount amount; - int64_t bank_row; + uint64_t bank_row; struct TALER_ReservePublicKeyP reserve_pub; bool suppressed; @@ -699,8 +700,8 @@ struct TALER_AUDITORDB_MisattributionInInconsistency struct TALER_AUDITORDB_Reserves { - unsigned int row_id; - int64_t auditor_reserves_rowid; + uint64_t row_id; + uint64_t auditor_reserves_rowid; struct TALER_ReservePublicKeyP reserve_pub; struct TALER_Amount reserve_balance; struct TALER_Amount reserve_loss; @@ -717,8 +718,8 @@ struct TALER_AUDITORDB_Reserves struct TALER_AUDITORDB_Purses { - unsigned int row_id; - int64_t auditor_purses_rowid; + uint64_t row_id; + uint64_t auditor_purses_rowid; struct TALER_PurseContractPublicKeyP purse_pub; struct TALER_Amount balance; struct TALER_Amount target; @@ -729,7 +730,7 @@ struct TALER_AUDITORDB_Purses struct TALER_AUDITORDB_HistoricDenominationRevenue { - unsigned int row_id; + uint64_t row_id; struct TALER_DenominationHashP denom_pub_hash; struct GNUNET_TIME_Absolute revenue_timestamp; struct TALER_Amount revenue_balance; @@ -740,11 +741,11 @@ struct TALER_AUDITORDB_HistoricDenominationRevenue struct TALER_AUDITORDB_DenominationPending { - unsigned int row_id; + uint64_t row_id; struct TALER_DenominationHashP denom_pub_hash; struct TALER_Amount denom_balance; struct TALER_Amount denom_loss; - int64_t num_issued; + uint64_t num_issued; struct TALER_Amount denom_risk; struct TALER_Amount recoup_loss; bool suppressed; @@ -753,7 +754,7 @@ struct TALER_AUDITORDB_DenominationPending struct TALER_AUDITORDB_HistoricReserveSummary { - unsigned int row_id; + uint64_t row_id; struct GNUNET_TIME_Absolute start_date; struct GNUNET_TIME_Absolute end_date; struct TALER_Amount reserve_profits; @@ -763,7 +764,7 @@ struct TALER_AUDITORDB_HistoricReserveSummary struct TALER_AUDITORDB_ExchangeSignkeys { - unsigned int row_id; + uint64_t row_id; struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_MasterSignatureP master_sig; struct GNUNET_TIME_Absolute ep_valid_from; @@ -775,7 +776,7 @@ struct TALER_AUDITORDB_ExchangeSignkeys struct TALER_AUDITORDB_WireFormatInconsistency { - unsigned int row_id; + uint64_t row_id; struct TALER_Amount amount; int64_t wire_offset; char *diagnostic; @@ -785,8 +786,9 @@ struct TALER_AUDITORDB_WireFormatInconsistency struct TALER_AUDITORDB_WireOutInconsistency { - unsigned int row_id; + uint64_t row_id; char *destination_account; + char *diagnostic; // FIXME: new struct TALER_Amount expected; struct TALER_Amount claimed; bool suppressed; @@ -795,7 +797,7 @@ struct TALER_AUDITORDB_WireOutInconsistency struct TALER_AUDITORDB_RowMinorInconsistencies { - unsigned int row_id; + uint64_t row_id; char *row_table; char *diagnostic; bool suppressed; @@ -804,7 +806,7 @@ struct TALER_AUDITORDB_RowMinorInconsistencies struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency { - unsigned int row_id; + uint64_t row_id; struct TALER_ReservePublicKeyP reserve_pub; struct TALER_Amount exchange_amount; struct TALER_Amount auditor_amount; @@ -814,7 +816,7 @@ struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency struct TALER_AUDITORDB_ReserveNotClosedInconsistency { - unsigned int row_id; + uint64_t row_id; struct TALER_ReservePublicKeyP reserve_pub; struct TALER_Amount balance; struct GNUNET_TIME_Absolute expiration_time; diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h @@ -492,6 +492,7 @@ struct TALER_EXCHANGE_Keys /** * Array of amounts a wallet is allowed to hold from * this exchange before it must undergo further KYC checks. + * Length is given in @e wblwk_length. */ struct TALER_Amount *wallet_balance_limit_without_kyc; @@ -550,6 +551,20 @@ struct TALER_EXCHANGE_Keys struct TALER_Amount stefan_log; /** + * Maximum amount for an individual transaction. + * Set to an invalid amount (see #TALER_amount_is_valid()) + * if there is no limit. + */ + struct TALER_Amount transaction_limit; + + /** + * Maximum amount that can be refunded per individual transaction. + * Set to an invalid amount (see #TALER_amount_is_valid()) + * if there is no limit. + */ + struct TALER_Amount refund_limit; + + /** * Linear STEFAN parameter. */ double stefan_lin; diff --git a/src/include/taler_kyclogic_lib.h b/src/include/taler_kyclogic_lib.h @@ -238,10 +238,12 @@ TALER_KYCLOGIC_kyc_trigger2s (enum TALER_KYCLOGIC_KycTriggerEvent trigger); * Initialize KYC subsystem. Loads the KYC configuration. * * @param cfg configuration to parse + * @param cfg_fn configuration filename for AML helpers * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -TALER_KYCLOGIC_kyc_init (const struct GNUNET_CONFIGURATION_Handle *cfg); +TALER_KYCLOGIC_kyc_init (const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *cfg_fn); /** diff --git a/src/include/taler_util.h b/src/include/taler_util.h @@ -158,7 +158,9 @@ TALER_b2s (const void *buf, * @param section section of the configuration to access * @param option option of the configuration to access * @param[out] denom set to the amount found in configuration - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if not found, + * #GNUNET_SYSERR on error */ enum GNUNET_GenericReturnValue TALER_config_get_amount (const struct GNUNET_CONFIGURATION_Handle *cfg, diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c @@ -228,7 +228,7 @@ struct TALER_KYCLOGIC_AmlProgram char *fallback; /** - * Output of @e command "--required-context". + * Output of @e command "-r". */ char **required_contexts; @@ -238,7 +238,7 @@ struct TALER_KYCLOGIC_AmlProgram unsigned int num_required_contexts; /** - * Output of @e command "--required-attributes". + * Output of @e command "-a". */ char **required_attributes; @@ -295,6 +295,11 @@ static struct TALER_KYCLOGIC_AmlProgram **aml_programs; */ static unsigned int num_aml_programs; +/** + * Name of our configuration file. + */ +static char *cfg_filename; + struct GNUNET_TIME_Timestamp TALER_KYCLOGIC_rules_get_expiration ( @@ -1113,6 +1118,8 @@ command_output (const char *command, execlp (command, command, argument, + "-c", + cfg_filename, NULL); GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "exec", @@ -1302,6 +1309,7 @@ load_logic (const struct GNUNET_CONFIGURATION_Handle *cfg, char *lib_name; struct TALER_KYCLOGIC_Plugin *plugin; + GNUNET_asprintf (&lib_name, "libtaler_plugin_kyclogic_%s", name); @@ -1991,23 +1999,23 @@ add_program (const struct GNUNET_CONFIGURATION_Handle *cfg, } required_contexts = command_output (command, - "--required-context"); + "-r"); if (NULL == required_contexts) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, section, "COMMAND", - "output for --required-context invalid"); + "output for -r invalid"); goto fail; } required_attributes = command_output (command, - "--required-attributes"); + "-a"); if (NULL == required_attributes) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, section, "COMMAND", - "output for --required-attributes invalid"); + "output for -a invalid"); goto fail; } @@ -2209,13 +2217,15 @@ sort_by_timeframe (const void *p1, enum GNUNET_GenericReturnValue TALER_KYCLOGIC_kyc_init ( - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *cfg_fn) { struct SectionContext sc = { .cfg = cfg, .result = true }; + cfg_filename = GNUNET_strdup (cfg_fn); GNUNET_CONFIGURATION_iterate_sections (cfg, &handle_provider_section, &sc); @@ -2422,6 +2432,7 @@ TALER_KYCLOGIC_kyc_done (void) GNUNET_array_grow (aml_programs, num_aml_programs, 0); + GNUNET_free (cfg_filename); } @@ -2865,8 +2876,9 @@ TALER_KYCLOGIC_measure_to_requirement ( xids), GNUNET_JSON_pack_string ("description", kc->description), - GNUNET_JSON_pack_object_incref ("description_i18n", - (json_t *) kc->description_i18n)); + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_object_incref ("description_i18n", + (json_t *) kc->description_i18n))); GNUNET_free (xids); return kri; case TALER_KYCLOGIC_CT_LINK: diff --git a/src/kyclogic/taler-exchange-helper-converter-oauth2-test-full_name b/src/kyclogic/taler-exchange-helper-converter-oauth2-test-full_name @@ -28,7 +28,10 @@ set -eu echo "Running $0" 1>&2 -if [ "${1:-no}" = "--list-outputs" ] +# FIXME: use getopt properly here, also support +# -h, -v, -V, ... + +if [ "${1:-no}" = "-o" ] then # This converter produces a full name and birthdate. echo "full_name" diff --git a/src/kyclogic/taler-exchange-helper-measure-freeze b/src/kyclogic/taler-exchange-helper-measure-freeze @@ -18,24 +18,63 @@ # Hard error reporting on. set -eu -echo "Running $0" 1>&2 -# This is a KYC measure program that freezes -# the account and flags it for manual investigation. -# This is the ultimate fallback measure. -if [ "${1:-no}" = "--required-context" ] -then - # No context is required. - exit 0 -fi +# Exit, with error message (hard failure) +function exit_fail() { + echo " FAIL: " "$@" >&2 + EXIT_STATUS=1 + exit "$EXIT_STATUS" +} + +CONF="$HOME/.config/taler.conf" +VERBOSE=0 -if [ "${1:-no}" = "--required-attributes" ] +while getopts 'ac:hrvV' OPTION; +do + case "$OPTION" in + a) + # No attributes are required. + exit 0 + ;; + c) + # shellcheck disable=SC2034 + CONF="$OPTARG" + ;; + h) + echo "This is a KYC measure program that freezes the account and flags it for manual investigation. This is the ultimate fallback measure." + echo 'Supported options:' + echo ' -a -- show required attributes' + # shellcheck disable=SC2016 + echo ' -c $CONF -- set configuration' + echo ' -h -- print this help' + echo ' -r -- show required context' + echo ' -v -- show version' + echo ' -V -- be verbose' + ;; + r) + # No context is required. + exit 0 + ;; + v) + echo "$0 v0.0.0" + exit 0 + ;; + V) + VERBOSE=1 + ;; + ?) + exit_fail "Unrecognized command line option" + ;; + esac +done + +if [ 1 = "$VERBOSE" ] then - # No required attributes. - exit 0 + echo "Running $0" 1>&2 fi + # See https://docs.taler.net/taler-exchange-manual.html#tsref-type-AmlProgramInput # for the full JSON with possible inputs. diff --git a/src/kyclogic/taler-exchange-helper-measure-test-form b/src/kyclogic/taler-exchange-helper-measure-test-form @@ -18,31 +18,67 @@ # Hard error reporting on. set -eu -echo "Running $0" 1>&2 -# This is a KYC measure program that checks the output -# of a simple FORM submission, and if it passed, -# increases all limits to EUR:1000. -# (and doesn't impose any other limits) +# Exit, with error message (hard failure) +function exit_fail() { + echo " FAIL: " "$@" >&2 + EXIT_STATUS=1 + exit "$EXIT_STATUS" +} -if [ "${1:-no}" = "--required-context" ] -then - # No context is required. - exit 0 -fi +CONF="$HOME/.config/taler.conf" +VERBOSE=0 + +while getopts 'ac:hrvV' OPTION; +do + case "$OPTION" in + a) + # This AML program expects as inputs a full_name + # and a birthdate. + echo "full_name" + echo "birthdate" + exit 0 + ;; + c) + # shellcheck disable=SC2034 + CONF="$OPTARG" + ;; + h) + echo "This is a KYC measure program that checks the output of a simple FORM submission, and if it passed, increases all limits to EUR:1000. (and does not impose any other limits)" + echo 'Supported options:' + echo ' -a -- show required attributes' + # shellcheck disable=SC2016 + echo ' -c $CONF -- set configuration' + echo ' -h -- print this help' + echo ' -r -- show required context' + echo ' -v -- show version' + echo ' -V -- be verbose' + ;; + r) + # No context is required. + exit 0 + ;; + v) + echo "$0 v0.0.0" + exit 0 + ;; + V) + VERBOSE=1 + ;; + ?) + exit_fail "Unrecognized command line option" + ;; + esac +done -if [ "${1:-no}" = "--required-attributes" ] +if [ 1 = "$VERBOSE" ] then - # This AML program expects as inputs a full_name - # and a birthdate. - echo "full_name" - echo "birthdate" - exit 0 + echo "Running $0" 1>&2 fi # First, check everything we expect is in stdin. A=$(jq -r .attributes) -J=$(echo $A | jq -r 'def get($k): +J=$(echo "$A" | jq -r 'def get($k): if has($k) then .[$k] else error("attribute missing") diff --git a/src/kyclogic/taler-exchange-helper-measure-test-oauth b/src/kyclogic/taler-exchange-helper-measure-test-oauth @@ -18,31 +18,66 @@ # Hard error reporting on. set -eu -echo "Running $0" 1>&2 +# Exit, with error message (hard failure) +function exit_fail() { + echo " FAIL: " "$@" >&2 + EXIT_STATUS=1 + exit "$EXIT_STATUS" +} -# This is a KYC measure program that checks the output -# of an OAuth2 authentication, and if it passed, -# increases all limits to EUR:1000. -# (and doesn't impose any other limits) +CONF="$HOME/.config/taler.conf" +VERBOSE=0 -if [ "${1:-no}" = "--required-context" ] -then - # No context is required. - exit 0 -fi +while getopts 'ac:hrvV' OPTION; +do + case "$OPTION" in + a) + # This AML program expects as inputs a full_name + # and a birthdate. + echo "full_name" + echo "birthdate" + exit 0 + ;; + c) + # shellcheck disable=SC2034 + CONF="$OPTARG" + ;; + h) + echo "This is a KYC measure program that checks the output of an OAuth2 authentication, and if it passed, increases all limits to EUR:1000. (and does not impose any other limits)" + echo 'Supported options:' + echo ' -a -- show required attributes' + # shellcheck disable=SC2016 + echo ' -c $CONF -- set configuration' + echo ' -h -- print this help' + echo ' -r -- show required context' + echo ' -v -- show version' + echo ' -V -- be verbose' + ;; + r) + # No context is required. + exit 0 + ;; + v) + echo "$0 v0.0.0" + exit 0 + ;; + V) + VERBOSE=1 + ;; + ?) + exit_fail "Unrecognized command line option" + ;; + esac +done -if [ "${1:-no}" = "--required-attributes" ] +if [ 1 = "$VERBOSE" ] then - # This AML program expects as inputs a full_name - # and a birthdate. - echo "full_name" - echo "birthdate" - exit 0 + echo "Running $0" 1>&2 fi # First, check everything we expect is in stdin. A=$(jq -r .attributes) -J=$(echo $A | jq -r 'def get($k): +J=$(echo "$A" | jq -r 'def get($k): if has($k) then .[$k] else error("attribute missing") diff --git a/src/kyclogic/taler-exchange-kyc-tester.c b/src/kyclogic/taler-exchange-kyc-tester.c @@ -1559,7 +1559,8 @@ run (void *cls, GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); if (GNUNET_OK != - TALER_KYCLOGIC_kyc_init (config)) + TALER_KYCLOGIC_kyc_init (config, + cfgfile)) { global_ret = EXIT_NOTCONFIGURED; GNUNET_SCHEDULER_shutdown (); diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am @@ -18,7 +18,7 @@ lib_LTLIBRARIES = \ libtalerexchange.la libtalerexchange_la_LDFLAGS = \ - -version-info 8:0:0 \ + -version-info 9:0:0 \ -no-undefined libtalerexchange_la_SOURCES = \ exchange_api_add_aml_decision.c \ diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c @@ -74,7 +74,7 @@ * how long do we assume the reply to be valid at least? */ #define MINIMUM_EXPIRATION GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MINUTES, 2) + GNUNET_TIME_UNIT_MINUTES, 2) /** @@ -363,7 +363,8 @@ TEAH_get_auditors_for_dc ( if (0 == keys->num_auditors) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "No auditor available. Not submitting deposit confirmations.\n"); + "No auditor available. Not submitting deposit confirmations.\n") + ; return; } for (unsigned int i = 0; i<keys->num_auditors; i++) @@ -379,9 +380,9 @@ TEAH_get_auditors_for_dc ( #define EXITIF(cond) \ - do { \ - if (cond) { GNUNET_break (0); goto EXITIF_exit; } \ - } while (0) + do { \ + if (cond) { GNUNET_break (0); goto EXITIF_exit; } \ + } while (0) /** @@ -932,6 +933,18 @@ decode_keys_json (const json_t *resp_obj, "stefan_log", currency, &key_data->stefan_log), + GNUNET_JSON_spec_mark_optional ( + TALER_JSON_spec_amount ( + "transaction_amount_limit", + currency, + &key_data->transaction_limit), + NULL), + GNUNET_JSON_spec_mark_optional ( + TALER_JSON_spec_amount ( + "refund_amount_limit", + currency, + &key_data->refund_limit), + NULL), GNUNET_JSON_spec_double ( "stefan_lin", &key_data->stefan_lin), @@ -1411,7 +1424,8 @@ keys_completed_cb (void *cls, &kd_old->denom_keys[i].key); kd->num_auditors = kd_old->num_auditors; kd->auditors = GNUNET_new_array (kd->num_auditors, - struct TALER_EXCHANGE_AuditorInformation); + struct TALER_EXCHANGE_AuditorInformation) + ; /* Now the necessary deep copy... */ for (unsigned int i = 0; i<kd_old->num_auditors; i++) { diff --git a/src/util/config.c b/src/util/config.c @@ -37,9 +37,7 @@ TALER_config_get_amount (const struct GNUNET_CONFIGURATION_Handle *cfg, option, &str)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - section, - option); + /* may be OK! */ return GNUNET_NO; } if (GNUNET_OK !=