commit 6a620224d26000d9dcea67bf3c60602533714760 parent 83a2457555d515b73ad1d4d126d560af9d300866 Author: Christian Grothoff <grothoff@gnunet.org> Date: Tue, 20 Aug 2024 08:51:05 +0200 Merge branch 'master' of git+ssh://git.taler.net/exchange Diffstat:
61 files changed, 866 insertions(+), 1877 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 @@ -273,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; /** @@ -466,21 +468,6 @@ check_pending_rc (void *cls, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return GNUNET_SYSERR; } -#if TO_BE_REMOVED_DEAD_CODE - 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), @@ -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). - */ - 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? + * Target account hash. */ - /* 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,9 +790,7 @@ generate_report (void *cls, void *value) { struct ReasonDetail *rd = value; - // 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 */ @@ -839,14 +804,15 @@ generate_report (void *cls, TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_amount_lag), &TALER_ARL_USE_AB (total_amount_lag), &rd->total_amount); - // TODO add kyc lag db entry -#if FIXME { enum GNUNET_DB_QueryStatus qs; - 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; @@ -854,24 +820,6 @@ generate_report (void *cls, return GNUNET_SYSERR; } } -#endif -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report (report_kyc_lags, - 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))); -#endif - return free_report_entry (cls, key, value); @@ -879,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. * @@ -905,20 +852,15 @@ report_wire_missing_cb (void *cls, { 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 { @@ -1047,7 +989,11 @@ check_for_required_transfers (void) GNUNET_CONTAINER_multishortmap_destroy (rc.map); /* conclude with success */ commit (global_qs); - GNUNET_SCHEDULER_shutdown (); + if (test_mode) + { + GNUNET_SCHEDULER_shutdown (); + return; + } } @@ -1119,16 +1065,6 @@ check_time_difference (const char *table, return false; } } -#if TO_BE_REMOVED_DEAD_CODE - 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; } @@ -1196,25 +1132,6 @@ wire_out_cb (void *cls, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return GNUNET_SYSERR; } -#if TO_BE_REMOVED_DEAD_CODE - 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 (&TALER_ARL_USE_AB (total_bad_amount_out_minus), &TALER_ARL_USE_AB (total_bad_amount_out_minus), amount); @@ -1246,27 +1163,6 @@ wire_out_cb (void *cls, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return GNUNET_SYSERR; } -#if TO_BE_REMOVED_DEAD_CODE - 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 (&TALER_ARL_USE_AB (total_bad_amount_out_plus), &TALER_ARL_USE_AB (total_bad_amount_out_plus), &roi->details.amount); @@ -1296,25 +1192,6 @@ wire_out_cb (void *cls, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return GNUNET_SYSERR; } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report ( - 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 if (0 < TALER_amount_cmp (amount, &roi->details.amount)) { @@ -1444,16 +1321,16 @@ complain_out_not_found (void *cls, }; (void) key; - hash_rc (roi->details.credit_account_uri, - &roi->details.wtid, - &rkey); - GNUNET_CONTAINER_multihashmap_get_multiple (reserve_closures, - &rkey, - &check_rc_matches, - &ctx); - if (ctx.found) - return GNUNET_OK; - /* check for profit drain */ + hash_rc (roi->details.credit_account_uri, + &roi->details.wtid, + &rkey); + GNUNET_CONTAINER_multihashmap_get_multiple (reserve_closures, + &rkey, + &check_rc_matches, + &ctx); + if (ctx.found) + return GNUNET_OK; + /* check for profit drain */ { enum GNUNET_DB_QueryStatus qs; uint64_t serial; @@ -1462,8 +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_WireOutInconsistency woi2; - // struct TALER_AUDITORDB_WireOutInconsistency woi3; qs = TALER_ARL_edb->get_drain_profit (TALER_ARL_edb->cls, &roi->details.wtid, @@ -1475,168 +1350,113 @@ complain_out_not_found (void *cls, &master_sig); switch (qs) { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - global_ret = EXIT_FAILURE; - GNUNET_SCHEDULER_shutdown (); - return GNUNET_SYSERR; - case GNUNET_DB_STATUS_SOFT_ERROR: - /* should fail on commit later ... */ + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); + return GNUNET_SYSERR; + case GNUNET_DB_STATUS_SOFT_ERROR: + /* should fail on commit later ... */ + GNUNET_break (0); + return GNUNET_NO; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + /* not a profit drain */ + break; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Profit drain of %s to %s found!\n", + TALER_amount2s (&amount), + payto_uri); + if (GNUNET_OK != + TALER_exchange_offline_profit_drain_verify ( + &roi->details.wtid, + request_timestamp, + &amount, + account_section, + payto_uri, + &TALER_ARL_master_pub, + &master_sig)) + { + struct TALER_AUDITORDB_RowInconsistency ri = { + .row_id = roi->details.serial_id, + .row_table = "profit_drains", + .diagnostic = "invalid signature" + }; + GNUNET_break (0); - return GNUNET_NO; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - /* not a profit drain */ - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Profit drain of %s to %s found!\n", - TALER_amount2s (&amount), - payto_uri); - if (GNUNET_OK != - TALER_exchange_offline_profit_drain_verify ( - &roi->details.wtid, - request_timestamp, - &amount, - account_section, - payto_uri, - &TALER_ARL_master_pub, - &master_sig)) + qs = TALER_ARL_adb->insert_row_inconsistency ( + TALER_ARL_adb->cls, + &ri); + if (qs < 0) { - 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; - } -#if TO_BE_REMOVED_DEAD_CODE - 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 (&TALER_ARL_USE_AB (total_bad_amount_out_plus), - &TALER_ARL_USE_AB (total_bad_amount_out_plus), - &amount); + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; } - else if (0 != - strcasecmp (payto_uri, - roi->details.credit_account_uri)) + 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)) + { + 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) { - 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; - } -#if TO_BE_REMOVED_DEAD_CODE - TALER_ARL_report ( - report_wire_out_inconsistencies, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row", - serial), - TALER_JSON_pack_amount ("amount_expected", - &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 (&TALER_ARL_USE_AB (total_bad_amount_out_plus), - &TALER_ARL_USE_AB (total_bad_amount_out_plus), - &amount); + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; } - else if (0 != - TALER_amount_cmp (&amount, - &roi->details.amount)) + 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)) + { + 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) { - 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; - } - -#if TO_BE_REMOVED_DEAD_CODE - 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 (&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 (&TALER_ARL_USE_AB (total_bad_amount_out_plus), - &TALER_ARL_USE_AB (total_bad_amount_out_plus), - &amount); + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + return GNUNET_SYSERR; } - GNUNET_free (account_section); - GNUNET_free (payto_uri); - /* profit drain was correct */ - TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_drained), - &TALER_ARL_USE_AB (total_drained), + 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 (&TALER_ARL_USE_AB (total_bad_amount_out_plus), + &TALER_ARL_USE_AB (total_bad_amount_out_plus), &amount); - return GNUNET_OK; + } + GNUNET_free (account_section); + GNUNET_free (payto_uri); + /* profit drain was correct */ + TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_drained), + &TALER_ARL_USE_AB (total_drained), + &amount); + return GNUNET_OK; } } @@ -1660,29 +1480,10 @@ complain_out_not_found (void *cls, return GNUNET_SYSERR; } } -#if TO_BE_REMOVED_DEAD_CODE - 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 (&TALER_ARL_USE_AB (total_bad_amount_out_plus), - &TALER_ARL_USE_AB (total_bad_amount_out_plus), - &roi->details.amount); - return GNUNET_OK; + 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; } @@ -1755,85 +1556,75 @@ history_debit_cb (void *cls, wa->dhh = NULL; switch (dhr->http_status) { - case MHD_HTTP_OK: - for (unsigned int i = 0; i < dhr->details.ok.details_length; i++) + case MHD_HTTP_OK: + for (unsigned int i = 0; i < dhr->details.ok.details_length; i++) + { + const struct TALER_BANK_DebitDetails *dd + = &dhr->details.ok.details[i]; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Analyzing bank DEBIT at %s of %s with WTID %s\n", + GNUNET_TIME_timestamp2s (dd->execution_date), + TALER_amount2s (&dd->amount), + TALER_B2S (&dd->wtid)); + /* Update offset */ + wa->wire_off_out = dd->serial_id; + slen = strlen (dd->credit_account_uri) + 1; + roi = GNUNET_malloc (sizeof (struct ReserveOutInfo) + + slen); + GNUNET_CRYPTO_hash (&dd->wtid, + sizeof (dd->wtid), + &roi->subject_hash); + roi->details.amount = dd->amount; + roi->details.execution_date = dd->execution_date; + roi->details.wtid = dd->wtid; + roi->details.credit_account_uri = (const char *) &roi[1]; + GNUNET_memcpy (&roi[1], + dd->credit_account_uri, + slen); + if (GNUNET_OK != + GNUNET_CONTAINER_multihashmap_put (out_map, + &roi->subject_hash, + roi, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) { - const struct TALER_BANK_DebitDetails *dd - = &dhr->details.ok.details[i]; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Analyzing bank DEBIT at %s of %s with WTID %s\n", - GNUNET_TIME_timestamp2s (dd->execution_date), - TALER_amount2s (&dd->amount), - TALER_B2S (&dd->wtid)); - /* Update offset */ - wa->wire_off_out = dd->serial_id; - slen = strlen (dd->credit_account_uri) + 1; - roi = GNUNET_malloc (sizeof (struct ReserveOutInfo) - + slen); - GNUNET_CRYPTO_hash (&dd->wtid, - sizeof (dd->wtid), - &roi->subject_hash); - roi->details.amount = dd->amount; - roi->details.execution_date = dd->execution_date; - roi->details.wtid = dd->wtid; - roi->details.credit_account_uri = (const char *) &roi[1]; - GNUNET_memcpy (&roi[1], - dd->credit_account_uri, - slen); - if (GNUNET_OK != - GNUNET_CONTAINER_multihashmap_put (out_map, - &roi->subject_hash, - roi, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) + 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, + &wfi); + + if (qs < 0) { - 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, - &wfi); - - if (qs < 0) - { - global_qs = qs; - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); - commit (qs); - return; - } - TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_wire_format_amount), - &TALER_ARL_USE_AB (total_wire_format_amount), - &dd->amount); -#if TO_BE_REMOVED_DEAD_CODE - 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 + global_qs = qs; + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + commit (qs); + return; } + 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); + return; + case MHD_HTTP_NO_CONTENT: + check_exchange_wire_out (wa); + return; + case MHD_HTTP_NOT_FOUND: + if (ignore_account_404) + { check_exchange_wire_out (wa); return; - case MHD_HTTP_NO_CONTENT: - check_exchange_wire_out (wa); - return; - case MHD_HTTP_NOT_FOUND: - if (ignore_account_404) - { - check_exchange_wire_out (wa); - return; - } - break; - default: - break; + } + break; + default: + break; } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error fetching debit history of account %s: %u/%u!\n", @@ -1859,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) { @@ -1962,22 +1753,6 @@ reserve_closed_cb (void *cls, GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); return GNUNET_OK; } -#if TO_BE_REMOVED_DEAD_CODE - 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; @@ -2074,25 +1849,25 @@ begin_transaction (void) NULL); switch (qs) { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - return qs; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - return qs; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - GNUNET_assert (GNUNET_OK == - TALER_amount_set_zero (TALER_ARL_currency, - &TALER_ARL_USE_AB (total_drained))); - GNUNET_assert (GNUNET_OK == - TALER_amount_set_zero (TALER_ARL_currency, - &TALER_ARL_USE_AB (total_wire_out))) - ; - had_start_balance = false; - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - had_start_balance = true; - break; + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + return qs; + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + return qs; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (TALER_ARL_currency, + &TALER_ARL_USE_AB (total_drained))); + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (TALER_ARL_currency, + &TALER_ARL_USE_AB (total_wire_out))) + ; + had_start_balance = false; + break; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + had_start_balance = true; + break; } for (struct WireAccount *wa = wa_head; NULL != wa; @@ -2224,8 +1999,6 @@ db_notify (void *cls, global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); } - - } 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-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; @@ -2207,33 +2217,57 @@ exchange_serve_process_config (const char *cfg_fn) } /* 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 != 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,6 +212,7 @@ struct TALER_AUDITORDB_Generic_Update */ struct TALER_AUDITORDB_AmountArithmeticInconsistency { + // FIXME: which row? uint64_t row_id; char *operation; struct TALER_Amount exchange_amount; 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_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 @@ -2876,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/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 !=