View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006758 | Taler | merchant backend | public | 2021-02-18 14:49 | 2024-01-12 14:04 |
Reporter | sebasjm | Assigned To | Christian Grothoff | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | git (master) | ||||
Target Version | 0.8 | Fixed in Version | 0.8 | ||
Summary | 0006758: creating an instance with multiple payto uris fails | ||||
Description | Trying to create an instance with multiple instance fails in the merchant backend side. Editing the instance after creating it to add more accounts works Postgres Log ERROR: duplicate key value violates unique constraint "merchant_accounts_merchant_serial_key" DETAIL: Key (merchant_serial)=(2) already exists. STATEMENT: INSERT INTO merchant_accounts(merchant_serial,h_wire,salt,payto_uri,active) SELECT merchant_serial, $2, $3, $4, $5 FROM merchant_instances WHERE merchant_id=$1 Example request: curl 'http://localhost:9966/private/instances' \ -H 'Authorization: Bearer secret-token:super_secret' \ --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","payto_uris":["payto://x-taler-bank/bank.taler:5882/blogger3","payto://x-taler-bank/bank.taler:5882/blogger2","payto://x-taler-bank/bank.taler:5882/blogger1"],"name":"qwe","id":"qwe"}' \ Response: HTTP/1.1 500 Internal Server Error { "code": 54, "hint": "The service encountered an error event to commit the database transaction (hard, unrecoverable error).", "detail": null } | ||||
Tags | No tags attached. | ||||
|
Adding here related issue, instead of creating new ticket Creating instance with one instance works, but updating it to add 3 more doesnt work as expected. Just add one at a time. To reproduce: 1.- create instance with one account 2.- query to get state, everytings ok 3.- patch 4.- query, two instance are missing 5.- patch, same request than 3 6.- query, one instance is missing $ curl -v 'http://localhost:9966/private/instances' -H 'Authorization: Bearer secret-token:super_secret' --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","payto_uris":["payto://x-taler-bank/bank.taler:5882/blogger3"],"name":"qwe","id":"qwe"}' --compressed < HTTP/1.1 204 No Content $ curl 'http://localhost:9966/private/instances/qwe' { "accounts": [ { "payto_uri": "payto://x-taler-bank/bank.taler:5882/blogger3", "h_wire": "75Y4A3J52STN1GZ7EW075BACBS0XZBTSB4WBP6TP0RQRMNQBK13D7PBT8Z544MZBBKE3XYSDB2J9MZ3T1YBRKSF8X1TSNJ1XTQ94ZF0", "salt": "Z6A92K3W3C96C44MMC26D7MESG9Y9J08Z43ET8ZY03TRHAWVGD32X09PAJTX5TM8R5FCQS19V53J4WQPGYZBZ7DZRXM0HGFR26HYM3R", "active": true } ], ... everything else } $ curl 'http://localhost:9966/private/instances/qwe' -X 'PATCH' -H 'Authorization: Bearer secret-token:super_secret' -H 'Content-Type: application/json;charset=UTF-8' --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"qwe","payto_uris":["payto://x-taler-bank/bank.taler:5882/one","payto://x-taler-bank/bank.taler:5882/two","payto://x-taler-bank/bank.taler:5882/three"]}' $ curl 'http://localhost:9966/private/instances/qwe' { "accounts": [ { "payto_uri": "payto://x-taler-bank/bank.taler:5882/one", "h_wire": "2PG2VV0KCYTYW5EGK7SWWJ9WBGZV0ZBN85E2XVZXD68DJFWAAKSXEHRK826M4QJS0H8XHTGVH1EEAMMS393T0R7Y85FZSWHKHCWWYE0", "salt": "PVXBBJB7VV71549Q3W7RNMJDX7E8VH86J6FB7ENHDQPMGRB8MAGYD8J3593ZYEEQ1ZPZDBD58C9AX8YEC7WJ4Y2D2YJMZGE597ERJW0", "active": true }, { "payto_uri": "payto://x-taler-bank/bank.taler:5882/blogger3", "h_wire": "75Y4A3J52STN1GZ7EW075BACBS0XZBTSB4WBP6TP0RQRMNQBK13D7PBT8Z544MZBBKE3XYSDB2J9MZ3T1YBRKSF8X1TSNJ1XTQ94ZF0", "salt": "Z6A92K3W3C96C44MMC26D7MESG9Y9J08Z43ET8ZY03TRHAWVGD32X09PAJTX5TM8R5FCQS19V53J4WQPGYZBZ7DZRXM0HGFR26HYM3R", "active": false } ], ... everything else } $ curl 'http://localhost:9966/private/instances/qwe' -X 'PATCH' -H 'Authorization: Bearer secret-token:super_secret' -H 'Content-Type: application/json;charset=UTF-8' --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"qwe","payto_uris":["payto://x-taler-bank/bank.taler:5882/one","payto://x-taler-bank/bank.taler:5882/two","payto://x-taler-bank/bank.taler:5882/three"]}' $ curl 'http://localhost:9966/private/instances/qwe' { "accounts": [ { "payto_uri": "payto://x-taler-bank/bank.taler:5882/two", "h_wire": "HC77QDJVWEVAPKNXSXN5AZT5DPMDKKEDNWSYFWN09PDC4DCH278AJHBASG5NAYWC5MBDC7Q3Q1JKRWQX6R8AGTQYBC2Y2GKWBX0MSBG", "salt": "1RYDTKMDQVZ7YKW0WWJP6P7B4NC0YCSME20ZAM5ZCN2MYGVN4T29P3RGT756K8YVTGA6P5N9PJVAZSSG7SZN2VFV50RZCCB363320MR", "active": true }, { "payto_uri": "payto://x-taler-bank/bank.taler:5882/one", "h_wire": "2PG2VV0KCYTYW5EGK7SWWJ9WBGZV0ZBN85E2XVZXD68DJFWAAKSXEHRK826M4QJS0H8XHTGVH1EEAMMS393T0R7Y85FZSWHKHCWWYE0", "salt": "PVXBBJB7VV71549Q3W7RNMJDX7E8VH86J6FB7ENHDQPMGRB8MAGYD8J3593ZYEEQ1ZPZDBD58C9AX8YEC7WJ4Y2D2YJMZGE597ERJW0", "active": true }, { "payto_uri": "payto://x-taler-bank/bank.taler:5882/blogger3", "h_wire": "75Y4A3J52STN1GZ7EW075BACBS0XZBTSB4WBP6TP0RQRMNQBK13D7PBT8Z544MZBBKE3XYSDB2J9MZ3T1YBRKSF8X1TSNJ1XTQ94ZF0", "salt": "Z6A92K3W3C96C44MMC26D7MESG9Y9J08Z43ET8ZY03TRHAWVGD32X09PAJTX5TM8R5FCQS19V53J4WQPGYZBZ7DZRXM0HGFR26HYM3R", "active": false } ], ... everything else } |
|
Trying to inactivate all the payto_uris just deactivate one of the array $ curl 'http://localhost:9966/private/instances/qwe' -X 'PATCH' -H 'Authorization: Bearer secret-token:super_secret' -H 'Content-Type: application/json;charset=UTF-8' --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"COL:2","default_max_deposit_fee":"COL:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"qwe","payto_uris":[]}' $ curl 'http://localhost:9966/private/instances/qwe' { "accounts": [ { "payto_uri": "payto://x-taler-bank/bank.taler:5882/three", "h_wire": "736YCS08F23VWG5526HHECF51RPV1V1BHZB4D12T1HRA039V31QNXWAQ5C1MWB2GDX8BXQ7XKNZ502JJR0MEN3CH8JNSYP5JYHXC3TG", "salt": "109WT8GFTE23W40Y2KX473TRH5Z6E6KW2GZY42ASS2FGCA0S9WPMTY15F8GG5QV6F77K8GFV029NMWYDB9V242XNVKDR2NDP5NJ8SRG", "active": false }, { "payto_uri": "payto://x-taler-bank/bank.taler:5882/two", "h_wire": "HC77QDJVWEVAPKNXSXN5AZT5DPMDKKEDNWSYFWN09PDC4DCH278AJHBASG5NAYWC5MBDC7Q3Q1JKRWQX6R8AGTQYBC2Y2GKWBX0MSBG", "salt": "1RYDTKMDQVZ7YKW0WWJP6P7B4NC0YCSME20ZAM5ZCN2MYGVN4T29P3RGT756K8YVTGA6P5N9PJVAZSSG7SZN2VFV50RZCCB363320MR", "active": true }, { "payto_uri": "payto://x-taler-bank/bank.taler:5882/one", "h_wire": "2PG2VV0KCYTYW5EGK7SWWJ9WBGZV0ZBN85E2XVZXD68DJFWAAKSXEHRK826M4QJS0H8XHTGVH1EEAMMS393T0R7Y85FZSWHKHCWWYE0", "salt": "PVXBBJB7VV71549Q3W7RNMJDX7E8VH86J6FB7ENHDQPMGRB8MAGYD8J3593ZYEEQ1ZPZDBD58C9AX8YEC7WJ4Y2D2YJMZGE597ERJW0", "active": true }, { "payto_uri": "payto://x-taler-bank/bank.taler:5882/blogger3", "h_wire": "75Y4A3J52STN1GZ7EW075BACBS0XZBTSB4WBP6TP0RQRMNQBK13D7PBT8Z544MZBBKE3XYSDB2J9MZ3T1YBRKSF8X1TSNJ1XTQ94ZF0", "salt": "Z6A92K3W3C96C44MMC26D7MESG9Y9J08Z43ET8ZY03TRHAWVGD32X09PAJTX5TM8R5FCQS19V53J4WQPGYZBZ7DZRXM0HGFR26HYM3R", "active": false } ], ...everything else } |
|
Can you please attach a (complete) shell script that, starting from a fresh merchant backend, reproduces the issue? |
|
This scripts reproduce the first two issues with demo.taler.net script-patch.sh (2,709 bytes)
#/bin/bash ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) echo create instance curl https://backend.demo.taler.net/private/instances -H 'Authorization: ApiKey sandbox' --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"KUDOS:2","default_max_deposit_fee":"KUDOS:1","payto_uris":["payto://x-taler-bank/bank.taler:5882/blogger3"],"name":"qwe","id":"'$ID'"}' echo add 3 accounts curl -X PATCH https://backend.demo.taler.net/private/instances/$ID -H 'Authorization: ApiKey sandbox' --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"KUDOS:2","default_max_deposit_fee":"KUDOS:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"qwe","payto_uris":["payto://x-taler-bank/bank.taler:5882/one","payto://x-taler-bank/bank.taler:5882/two","payto://x-taler-bank/bank.taler:5882/three"]}' echo should be 4, but is 2 curl -H "Authorization: ApiKey sandbox" https://backend.demo.taler.net/private/instances/$ID | jq '.accounts|length' echo try again curl -X PATCH https://backend.demo.taler.net/private/instances/$ID -H 'Authorization: ApiKey sandbox' --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"KUDOS:2","default_max_deposit_fee":"KUDOS:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"qwe","payto_uris":["payto://x-taler-bank/bank.taler:5882/one","payto://x-taler-bank/bank.taler:5882/two","payto://x-taler-bank/bank.taler:5882/three"]}' echo should be 4, but is 3 curl -H "Authorization: ApiKey sandbox" https://backend.demo.taler.net/private/instances/$ID | jq '.accounts|length' echo one more time curl -X PATCH https://backend.demo.taler.net/private/instances/$ID -H 'Authorization: ApiKey sandbox' --data-raw '{"default_pay_delay":{"d_ms":1000},"name":"www","merchant_pub":"3N4SC26BXAAF4QM9VJ1T6FQK074JN0YCXQK6CJ4MYXPS4TJYN4N0","address":{},"jurisdiction":{},"default_max_wire_fee":"KUDOS:2","default_max_deposit_fee":"KUDOS:1","default_wire_fee_amortization":10,"default_wire_transfer_delay":{"d_ms":2000},"id":"qwe","payto_uris":["payto://x-taler-bank/bank.taler:5882/one","payto://x-taler-bank/bank.taler:5882/two","payto://x-taler-bank/bank.taler:5882/three"]}' echo should be 4 curl -H "Authorization: ApiKey sandbox" https://backend.demo.taler.net/private/instances/$ID | jq '.accounts|length' script-database.sh (543 bytes)
#/bin/bash set -x ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) curl https://backend.demo.taler.net/private/instances -H 'Authorization: ApiKey sandbox' --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"KUDOS:2","default_max_deposit_fee":"KUDOS:1","payto_uris":["payto://x-taler-bank/bank.taler:5882/blogger3","payto://x-taler-bank/bank.taler:5882/blogger2"],"name":"qwe","id":"'$ID'"}' |
|
c3b8735..a1265a0 fixes the issue discovered by script-database: it removes a bogus UNIQUE constraint. |
|
Looks like the script-patch.sh is also fixed by the same patch. |
|
confirmed, the three issues were fixed |
|
tested on a1265a05 |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-18 14:49 | sebasjm | New Issue | |
2021-02-18 14:49 | sebasjm | Status | new => assigned |
2021-02-18 14:49 | sebasjm | Assigned To | => Christian Grothoff |
2021-02-18 14:59 | sebasjm | Note Added: 0017549 | |
2021-02-18 15:04 | sebasjm | Note Added: 0017550 | |
2021-02-18 18:59 | Christian Grothoff | Note Added: 0017551 | |
2021-02-18 20:40 | sebasjm | Note Added: 0017552 | |
2021-02-18 20:40 | sebasjm | File Added: script-patch.sh | |
2021-02-18 20:40 | sebasjm | File Added: script-database.sh | |
2021-02-19 00:22 | Christian Grothoff | Note Added: 0017553 | |
2021-02-19 00:25 | Christian Grothoff | Note Added: 0017554 | |
2021-02-19 17:48 | sebasjm | Note Added: 0017555 | |
2021-02-19 17:50 | sebasjm | Status | assigned => resolved |
2021-02-19 17:50 | sebasjm | Resolution | open => fixed |
2021-02-19 17:50 | sebasjm | Fixed in Version | => git (master) |
2021-02-19 17:50 | sebasjm | Note Added: 0017556 | |
2021-07-30 13:58 | Christian Grothoff | Fixed in Version | git (master) => 0.8.1 |
2021-07-30 13:59 | Christian Grothoff | Target Version | => 0.8.1 |
2021-07-30 14:01 | Christian Grothoff | Fixed in Version | 0.8.1 => 0.8 |
2021-07-30 14:01 | Christian Grothoff | Target Version | 0.8.1 => 0.8 |
2021-08-24 16:23 | Christian Grothoff | Status | resolved => closed |
2024-01-12 14:04 | Christian Grothoff | Category | merchant backend API (C) => mechant backend |
2025-03-22 14:09 | Christian Grothoff | Category | mechant backend => merchant backend |