another fix where hardcoded serial number can point to the wrong transaction

This commit is contained in:
Christian Grothoff 2019-12-24 22:53:13 +01:00
parent 296145fb26
commit 3a9d7afe33
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -437,14 +437,15 @@ echo "UPDATE deposits SET wire='$OLD_WIRE' WHERE deposit_serial_id=${SERIAL}" |
function test_5() { function test_5() {
echo "===========5: deposit contract hash wrong=================" echo "===========5: deposit contract hash wrong================="
# Modify h_wire hash, so it is inconsistent with 'wire' # Modify h_wire hash, so it is inconsistent with 'wire'
OLD_H=`echo 'SELECT h_contract_terms FROM deposits WHERE deposit_serial_id=1;' | psql $DB -Aqt` SERIAL=`echo "SELECT deposit_serial_id FROM deposits WHERE amount_with_fee_val=0 AND amount_with_fee_frac=10000000 ORDER BY deposit_serial_id LIMIT 1" | psql $DB -Aqt`
echo "UPDATE deposits SET h_contract_terms='\x12bb676444955c98789f219148aa31899d8c354a63330624d3d143222cf3bb8b8e16f69accd5a8773127059b804c1955696bf551dd7be62719870613332aa8d5' WHERE deposit_serial_id=1" | psql -Aqt $DB OLD_H=`echo "SELECT h_contract_terms FROM deposits WHERE deposit_serial_id=$SERIAL;" | psql $DB -Aqt`
echo "UPDATE deposits SET h_contract_terms='\x12bb676444955c98789f219148aa31899d8c354a63330624d3d143222cf3bb8b8e16f69accd5a8773127059b804c1955696bf551dd7be62719870613332aa8d5' WHERE deposit_serial_id=$SERIAL" | psql -Aqt $DB
run_audit run_audit
echo -n "Checking bad signature detection... " echo -n "Checking bad signature detection... "
ROW=`jq -e .bad_sig_losses[0].row < test-audit.json` ROW=`jq -e .bad_sig_losses[0].row < test-audit.json`
if test $ROW != 1 if test $ROW != $SERIAL
then then
exit_fail "Row wrong, got $ROW" exit_fail "Row wrong, got $ROW"
fi fi
@ -469,7 +470,7 @@ fi
echo PASS echo PASS
# Undo: # Undo:
echo "UPDATE deposits SET h_contract_terms='${OLD_H}' WHERE deposit_serial_id=1" | psql -Aqt $DB echo "UPDATE deposits SET h_contract_terms='${OLD_H}' WHERE deposit_serial_id=$SERIAL" | psql -Aqt $DB
} }