From ad22e61c10c6a4ddecef6d4dfd853042ee5fa847 Mon Sep 17 00:00:00 2001 From: Sergey Kroshnin Date: Tue, 12 Feb 2019 22:42:00 +0300 Subject: [PATCH] Support both nano_ and rai_ prefixes for unit conversion RPCs (#1719) --- nano/node/rpc.cpp | 28 ++++++++++++++-------------- nano/node/rpc.hpp | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/nano/node/rpc.cpp b/nano/node/rpc.cpp index 98448b50..0ea5fc5e 100644 --- a/nano/node/rpc.cpp +++ b/nano/node/rpc.cpp @@ -2118,7 +2118,7 @@ void nano::rpc_handler::ledger () response_errors (); } -void nano::rpc_handler::mrai_from_raw (nano::uint128_t ratio) +void nano::rpc_handler::mnano_from_raw (nano::uint128_t ratio) { auto amount (amount_impl ()); if (!ec) @@ -2129,7 +2129,7 @@ void nano::rpc_handler::mrai_from_raw (nano::uint128_t ratio) response_errors (); } -void nano::rpc_handler::mrai_to_raw (nano::uint128_t ratio) +void nano::rpc_handler::mnano_to_raw (nano::uint128_t ratio) { auto amount (amount_impl ()); if (!ec) @@ -4459,25 +4459,25 @@ void nano::rpc_handler::process_request () { key_expand (); } - else if (action == "krai_from_raw") + else if (action == "knano_from_raw" || action == "krai_from_raw") { - mrai_from_raw (nano::kxrb_ratio); + mnano_from_raw (nano::kxrb_ratio); } - else if (action == "krai_to_raw") + else if (action == "knano_to_raw" || action == "krai_to_raw") { - mrai_to_raw (nano::kxrb_ratio); + mnano_to_raw (nano::kxrb_ratio); } else if (action == "ledger") { ledger (); } - else if (action == "mrai_from_raw") + else if (action == "mnano_from_raw" || action == "mrai_from_raw") { - mrai_from_raw (); + mnano_from_raw (); } - else if (action == "mrai_to_raw") + else if (action == "mnano_to_raw" || action == "mrai_to_raw") { - mrai_to_raw (); + mnano_to_raw (); } else if (action == "node_id") { @@ -4531,13 +4531,13 @@ void nano::rpc_handler::process_request () { process (); } - else if (action == "nano_from_raw") + else if (action == "nano_from_raw" || action == "rai_from_raw") { - mrai_from_raw (nano::xrb_ratio); + mnano_from_raw (nano::xrb_ratio); } - else if (action == "nano_to_raw") + else if (action == "nano_to_raw" || action == "rai_to_raw") { - mrai_to_raw (nano::xrb_ratio); + mnano_to_raw (nano::xrb_ratio); } else if (action == "receive") { diff --git a/nano/node/rpc.hpp b/nano/node/rpc.hpp index bbeaebc2..518348c9 100644 --- a/nano/node/rpc.hpp +++ b/nano/node/rpc.hpp @@ -174,8 +174,8 @@ public: void key_create (); void key_expand (); void ledger (); - void mrai_to_raw (nano::uint128_t = nano::Mxrb_ratio); - void mrai_from_raw (nano::uint128_t = nano::Mxrb_ratio); + void mnano_to_raw (nano::uint128_t = nano::Mxrb_ratio); + void mnano_from_raw (nano::uint128_t = nano::Mxrb_ratio); void node_id (); void node_id_delete (); void password_change ();