Skip to content

Commit aedba91

Browse files
committed
restore the deprecation of external payment ids
1 parent de81583 commit aedba91

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

src/wallet/wallet2.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15030,6 +15030,12 @@ std::string wallet2::make_uri(const std::vector<std::string> &addresses, const s
1503015030
}
1503115031
}
1503215032

15033+
if (!payment_id.empty())
15034+
{
15035+
error = "Standalone payment id deprecated, use integrated address instead";
15036+
return std::string();
15037+
}
15038+
1503315039
std::string uri = "monero:" + addresses_str;
1503415040
unsigned int n_fields = 0;
1503515041

@@ -15049,17 +15055,6 @@ std::string wallet2::make_uri(const std::vector<std::string> &addresses, const s
1504915055
uri += (n_fields++ ? "&" : "?") + std::string("tx_description=") + custom_convert_to_url_format(tx_description);
1505015056
}
1505115057

15052-
if (!payment_id.empty())
15053-
{
15054-
crypto::hash pid32;
15055-
if (!wallet2::parse_long_payment_id(payment_id, pid32))
15056-
{
15057-
error = std::string("Failed to parse the long payment id which is provided, possibly the payment id is corrupted or is invalid: ") + payment_id;
15058-
return std::string();
15059-
}
15060-
uri += (n_fields++ ? "&" : "?") + std::string("tx_payment_id=") + payment_id;
15061-
}
15062-
1506315058
return uri;
1506415059
}
1506515060
//----------------------------------------------------------------------------------------------------

tests/functional_tests/uri.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,11 @@ def test_monero_uri(self):
143143
assert res.uri.recipient_name == utf8string[0]
144144
assert not 'unknown_parameters' in res or len(res.unknown_parameters) == 0
145145

146-
# standalone payment ids are supported but not recommended
147-
res = wallet.make_uri(address = address, recipient_name = utf8string[0], tx_description = utf8string[1], amount = 1000000000000, payment_id = '1' * 64)
148-
assert res.uri == 'monero:' + address + '?tx_amount=1.000000000000&recipient_name=' + quoted_utf8string[0] + '&tx_description=' + quoted_utf8string[1] + '&tx_payment_id=' + '1' * 64
149-
150-
# in case of standalone payment id removal
151-
# ok = False
152-
# try:
153-
# res = wallet.make_uri(address = address, recipient_name = utf8string[0], tx_description = utf8string[1], amount = 1000000000000, payment_id = '1' * 64)
154-
# except:
155-
# ok = True
156-
# assert ok
146+
# external payment ids are not supported anymore
147+
ok = False
148+
try: res = wallet.make_uri(address = address, recipient_name = utf8string[0], tx_description = utf8string[1], amount = 1000000000000, payment_id = '1' * 64)
149+
except: ok = True
150+
assert ok
157151

158152
# spaces must be encoded as %20
159153
res = wallet.make_uri(address = address, tx_description = ' ' + utf8string[1] + ' ' + utf8string[0] + ' ', amount = 1000000000000)
@@ -202,9 +196,8 @@ def test_monero_uri(self):
202196
'monero:42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm&tx_amount=10=&',
203197
'monero:42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm&tx_amount=10=&foo=bar',
204198
'monero:42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm?tx_amount=10&tx_amount=20',
205-
# Standalone payment ids are still supported, in case of complete functionality removal: uncomment this.
206-
# 'monero:42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm?tx_payment_id=1111111111111111',
207-
# 'monero:4BxSHvcgTwu25WooY4BVmgdcKwZu5EksVZSZkDd6ooxSVVqQ4ubxXkhLF6hEqtw96i9cf3cVfLw8UWe95bdDKfRQeYtPwLm1Jiw7AKt2LY?tx_payment_id=' + '1' * 64,
199+
'monero:42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm?tx_payment_id=1111111111111111',
200+
'monero:4BxSHvcgTwu25WooY4BVmgdcKwZu5EksVZSZkDd6ooxSVVqQ4ubxXkhLF6hEqtw96i9cf3cVfLw8UWe95bdDKfRQeYtPwLm1Jiw7AKt2LY?tx_payment_id=' + '1' * 64,
208201
'monero:9ujeXrjzf7bfeK3KZdCqnYaMwZVFuXemPU8Ubw335rj2FN1CdMiWNyFV3ksEfMFvRp9L9qum5UxkP5rN9aLcPxbH1au4WAB',
209202
'monero:5K8mwfjumVseCcQEjNbf59Um6R9NfVUNkHTLhhPCmNvgDLVS88YW5tScnm83rw9mfgYtchtDDTW5jEfMhygi27j1QYphX38hg6m4VMtN29',
210203
'monero:7A1Hr63MfgUa8pkWxueD5xBqhQczkusYiCMYMnJGcGmuQxa7aDBxN1G7iCuLCNB3VPeb2TW7U9FdxB27xKkWKfJ8VhUZthF',
@@ -232,6 +225,7 @@ def test_monero_uri(self):
232225
assert res.uri.amount == 239390140000000
233226
assert res.unknown_parameters == [u'unknown=' + quoted_utf8string[0]], res
234227

228+
235229
def test_monero_multi_uri(self):
236230
wallet = Wallet()
237231
addr1 = '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'

0 commit comments

Comments
 (0)