mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07:00
Merge pull request #5508
1c44e658
wallet2: reject standalone short payment IDs in monero: URI API (moneromooo-monero)
This commit is contained in:
commit
97cb1c9436
@ -12629,8 +12629,7 @@ std::string wallet2::make_uri(const std::string &address, const std::string &pay
|
|||||||
if (!payment_id.empty())
|
if (!payment_id.empty())
|
||||||
{
|
{
|
||||||
crypto::hash pid32;
|
crypto::hash pid32;
|
||||||
crypto::hash8 pid8;
|
if (!wallet2::parse_long_payment_id(payment_id, pid32))
|
||||||
if (!wallet2::parse_long_payment_id(payment_id, pid32) && !wallet2::parse_short_payment_id(payment_id, pid8))
|
|
||||||
{
|
{
|
||||||
error = "Invalid payment id";
|
error = "Invalid payment id";
|
||||||
return std::string();
|
return std::string();
|
||||||
@ -12724,8 +12723,7 @@ bool wallet2::parse_uri(const std::string &uri, std::string &address, std::strin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
crypto::hash hash;
|
crypto::hash hash;
|
||||||
crypto::hash8 hash8;
|
if (!wallet2::parse_long_payment_id(kv[1], hash))
|
||||||
if (!wallet2::parse_long_payment_id(kv[1], hash) && !wallet2::parse_short_payment_id(kv[1], hash8))
|
|
||||||
{
|
{
|
||||||
error = "Invalid payment id: " + kv[1];
|
error = "Invalid payment id: " + kv[1];
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,9 +144,7 @@ TEST(uri, bad_payment_id)
|
|||||||
|
|
||||||
TEST(uri, short_payment_id)
|
TEST(uri, short_payment_id)
|
||||||
{
|
{
|
||||||
PARSE_URI("monero:" TEST_ADDRESS"?tx_payment_id=1234567890123456", true);
|
PARSE_URI("monero:" TEST_ADDRESS"?tx_payment_id=1234567890123456", false);
|
||||||
ASSERT_EQ(address, TEST_ADDRESS);
|
|
||||||
ASSERT_EQ(payment_id, "1234567890123456");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(uri, long_payment_id)
|
TEST(uri, long_payment_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user