Skip to content

Commit

Permalink
Add equivalent check to validate admin endpoint (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnerd committed Sep 10, 2024
1 parent bf8e5e2 commit c37b2de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rpc/admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,14 @@ namespace lws { namespace rpc
db::account_address address{};
crypto::secret_key view_key{};

if (!convert_key(dest, address.spend_public, req.spend_public_hex, "spend_public_hex"))
if (req.spend_public_hex == req.view_public_hex)
{
output_error(dest, "spend_public_hex", "spend_public_hex and view_public_hex should not be equal");
return success(); // error is delivered in JSON as opposed to HTTP codes
}

if (!convert_key(dest, address.spend_public, req.spend_public_hex, "spend_public_hex"))
return success();
if (!convert_key(dest, address.view_public, req.view_public_hex, "view_public_hex"))
return success();
if (!convert_key(dest, unwrap(unwrap(view_key)), req.view_key_hex, "view_key_hex"))
Expand Down

0 comments on commit c37b2de

Please sign in to comment.