disallow integrated payout addresses

Batched transfers (`transfer_split`) fail with transfers to multiple
integrated addresses so simply disallow them.
This commit is contained in:
Jethro Grassie 2021-03-06 17:16:10 -05:00
parent 943f6a0875
commit 92de56716b
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
3 changed files with 19 additions and 5 deletions

View File

@ -2974,16 +2974,20 @@ miner_on_login(json_object *message, client_t *client)
const char *address = json_object_get_string(login);
uint8_t nt = 0;
if (parse_address(address, NULL, &nt, NULL))
uint64_t pf = 0;
if (parse_address(address, &pf, &nt, NULL))
{
send_validation_error(client,
"Invalid address");
send_validation_error(client, "Invalid address");
return;
}
if (nt != nettype)
{
send_validation_error(client,
"Invalid address network type");
send_validation_error(client, "Invalid address network type");
return;
}
if (is_integrated(pf))
{
send_validation_error(client, "Invalid address type");
return;
}

View File

@ -120,6 +120,15 @@ int parse_address(const char *input, uint64_t *prefix,
return XMR_NO_ERROR;
}
int is_integrated(uint64_t prefix)
{
if (prefix == CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ||
prefix == testnet::CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ||
prefix == stagenet::CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX)
return 1;
return 0;
}
int get_block_hash(const unsigned char *input, const size_t in_size,
unsigned char *output)
{

View File

@ -51,6 +51,7 @@ int get_hashing_blob(const unsigned char *input, const size_t in_size,
unsigned char **output, size_t *out_size);
int parse_address(const char *input, uint64_t *prefix,
uint8_t *nettype, unsigned char *pub_spend);
int is_integrated(uint64_t prefix);
int get_block_hash(const unsigned char *input, const size_t in_size,
unsigned char *output);
void get_hash(const unsigned char *input, const size_t in_size,