mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
wallet_rpc_server: reject standalone short payment id in address book
This commit is contained in:
parent
581994b61c
commit
ccc1e311dc
@ -2805,20 +2805,20 @@ namespace tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
crypto::hash long_payment_id;
|
crypto::hash long_payment_id;
|
||||||
crypto::hash8 short_payment_id;
|
|
||||||
|
|
||||||
if (!wallet2::parse_long_payment_id(req.payment_id, payment_id))
|
if (!wallet2::parse_long_payment_id(req.payment_id, payment_id))
|
||||||
{
|
{
|
||||||
if (!wallet2::parse_short_payment_id(req.payment_id, info.payment_id))
|
if (!wallet2::parse_short_payment_id(req.payment_id, info.payment_id))
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID;
|
er.code = WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID;
|
||||||
er.message = "Payment id has invalid format: \"" + req.payment_id + "\", expected 16 or 64 character string";
|
er.message = "Payment id has invalid format: \"" + req.payment_id + "\", expected 64 character string";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(payment_id.data, info.payment_id.data, 8);
|
er.code = WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID;
|
||||||
memset(payment_id.data + 8, 0, 24);
|
er.message = "Payment id has invalid format: standalone short payment IDs are forbidden, they must be part of an integrated address";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user