From 47858d53efaee9fb6f790090eddd1a3dfc7ff8e6 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 25 Sep 2022 13:20:44 +0300 Subject: [PATCH 01/11] Short testnet hf windows --- src/cryptonote_core/blockchain.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 9ff9b30457..40a634dd86 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -114,14 +114,14 @@ static const struct { } testnet_hard_forks[] = { // version 1 from the start of the blockchain { 1, 1, 0, config::testnet::GENESIS_TIMESTAMP }, - { 2, 101, 0, 1518115575 }, - { 3, 201, 0, 1518117468 }, - { 4, 301, 0, 1518118888 }, - { 5, 401, 0, 1539941268 }, - { 6, 501, 0, 1551264860 }, - { 7, 901, 0, 1551264860 + 1000 } // Give it some time offset + { 2, 11, 0, 1518115575 }, + { 3, 21, 0, 1518117468 }, + { 4, 31, 0, 1518118888 }, + { 5, 41, 0, 1539941268 }, + { 6, 51, 0, 1551264860 }, + { 7, 71, 0, 1551264860 + 1000 } // Give it some time offset }; -static const uint64_t testnet_hard_fork_version_1_till = 100; +static const uint64_t testnet_hard_fork_version_1_till = 10; //------------------------------------------------------------------ Blockchain::Blockchain(tx_memory_pool& tx_pool) : From 0d47181328440349889ef03dbb0f6c160a0727e5 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 25 Sep 2022 13:25:09 +0300 Subject: [PATCH 02/11] Don't use def patment id logic for swap addrs --- src/cryptonote_basic/cryptonote_basic_impl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cryptonote_basic/cryptonote_basic_impl.cpp b/src/cryptonote_basic/cryptonote_basic_impl.cpp index 43315d1119..6b3979cf42 100644 --- a/src/cryptonote_basic/cryptonote_basic_impl.cpp +++ b/src/cryptonote_basic/cryptonote_basic_impl.cpp @@ -250,6 +250,7 @@ namespace cryptonote { else if (swap_address_prefix == prefix || integrated_swap_address_prefix == prefix) { // Identify addr as swap addr adr.is_swap_addr = true; + has_payment_id = false; } else { From 2eb18baa2093f23449b8388f55ac53d22ae01982 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 25 Sep 2022 13:29:41 +0300 Subject: [PATCH 03/11] Simplewallet swap transfer creation --- src/simplewallet/simplewallet.cpp | 59 ++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 6586734066..25b6427358 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2439,12 +2439,19 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector dsts; for (size_t i = 0; i < local_args.size(); i += 2) { cryptonote::tx_destination_entry de; bool has_payment_id; crypto::hash8 new_payment_id; + + // If destination is on new blockchain + // Swap addr flag should be set in following line if (!cryptonote::get_account_address_from_str_or_url(de.addr, has_payment_id, new_payment_id, m_wallet->testnet(), local_args[i], oa_prompter)) { fail_msg_writer() << tr("failed to parse address"); @@ -2478,21 +2485,40 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vectorconfirm_missing_payment_id()) - { - std::string accepted = command_line::input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): ")); - if (std::cin.eof()) - return true; - if (!command_line::is_yes(accepted)) - { - fail_msg_writer() << tr("transaction cancelled."); + if (is_swap_transfer) { + // For now use random payment ids for swap transfers + crypto::hash payment_id; + generate_random_bytes_not_thread_safe(sizeof(crypto::hash), &payment_id); + set_swap_tx_extra(extra, payment_id, swap_addr); + } else { + // prompt is there is no payment id and confirmation is required + if (!payment_id_seen && m_wallet->confirm_missing_payment_id()) + { + std::string accepted = command_line::input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): ")); + if (std::cin.eof()) + return true; + if (!command_line::is_yes(accepted)) + { + fail_msg_writer() << tr("transaction cancelled."); - return true; - } + return true; + } + } } try @@ -2601,7 +2627,16 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector 1) { prompt << boost::format(tr("Your transaction needs to be split into %llu transactions. " From e734992ea60da6daea262a19331b5b6cd7d78de2 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 25 Sep 2022 13:30:31 +0300 Subject: [PATCH 04/11] Don't allow swap txs on view only wallets --- src/simplewallet/simplewallet.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 25b6427358..d2409f81a9 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2677,6 +2677,12 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vectorwatch_only()) { + if (is_swap_transfer) + { + fail_msg_writer() << tr("Swap txs not allowed on watch only wallets"); + return true; + } + bool r = m_wallet->save_tx(ptx_vector, "unsigned_monero_tx"); if (!r) { From bd3b80882ea5b465bad61fc5b281ca4a1d20d182 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 25 Sep 2022 13:31:29 +0300 Subject: [PATCH 05/11] Explicitly null swap tx key --- src/cryptonote_core/cryptonote_tx_utils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index 30f46e4f17..26f321fe5f 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -301,6 +301,7 @@ namespace cryptonote if (dst_entr.addr.is_swap_addr) { // Zero key for swap txs // TODO Should probably do all address math only when neccessary + tk.key = null_pkey; } else { tk.key = out_eph_public_key; } From ebd77ced43603fe70abe1d71a49f50f2867887cf Mon Sep 17 00:00:00 2001 From: bubafistah Date: Fri, 30 Sep 2022 18:03:56 +0300 Subject: [PATCH 06/11] Use regular wallet for swap --- src/cryptonote_core/cryptonote_tx_utils.cpp | 38 +++++++++++++++------ src/cryptonote_core/swap_address.h | 16 +++++++++ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index 26f321fe5f..c2af1dda38 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -37,6 +37,7 @@ using namespace epee; #include "crypto/crypto.h" #include "crypto/hash.h" #include "ringct/rctSigs.h" +#include "cryptonote_core/swap_address.h" namespace cryptonote { @@ -276,9 +277,25 @@ namespace cryptonote uint64_t summary_outs_money = 0; //fill outputs size_t output_index = 0; - for(const tx_destination_entry& dst_entr: shuffled_dsts) + for(tx_destination_entry& dst_entr: shuffled_dsts) { CHECK_AND_ASSERT_MES(dst_entr.amount > 0 || tx.version > 1, false, "Destination with wrong amount: " << dst_entr.amount); + + + if (dst_entr.addr.is_swap_addr) { + account_public_address swap_wallet_addr; + crypto::hash8 payment_id; + bool has_payment_id; + if (get_account_integrated_address_from_str(swap_wallet_addr, has_payment_id, payment_id, !SWAP_ENABLED, SWAP_WALLET)) + { + // Change target addr to swap_wallet + dst_entr.addr = swap_wallet_addr; + } else { + LOG_ERROR("Failed to decode swap wallet address"); + return false; + } + } + crypto::key_derivation derivation; crypto::public_key out_eph_public_key; bool r = crypto::generate_key_derivation(dst_entr.addr.m_view_public_key, txkey.sec, derivation); @@ -298,13 +315,13 @@ namespace cryptonote txout_to_key tk = AUTO_VAL_INIT(tk); - if (dst_entr.addr.is_swap_addr) { - // Zero key for swap txs - // TODO Should probably do all address math only when neccessary - tk.key = null_pkey; - } else { + //if (dst_entr.addr.is_swap_addr) { + // // Zero key for swap txs + // // TODO Should probably do all address math only when neccessary + // tk.key = null_pkey; + //} else { tk.key = out_eph_public_key; - } + //} out.target = tk; @@ -515,7 +532,7 @@ namespace cryptonote //--------------------------------------------------------------- bool is_swap_tx(const transaction& tx, const std::vector& destinations) { - // a tx is a swap tx if it has at least one swap destination address (null_pkey output) AND swap info in extra.userdata + // a tx is a swap tx if it has at least one swap destination address (null_pkey output)(not true anymore) AND swap info in extra.userdata bool has_swap_destinations = false; if (!destinations.empty()) @@ -542,8 +559,9 @@ namespace cryptonote } } - if (!has_swap_destinations) - return false; // No swap destinations + // Ignore, we are using regular swap wallet + //if (!has_swap_destinations) + // return false; // No swap destinations std::vector extra_fields; diff --git a/src/cryptonote_core/swap_address.h b/src/cryptonote_core/swap_address.h index d55d46c6bc..65b728486d 100644 --- a/src/cryptonote_core/swap_address.h +++ b/src/cryptonote_core/swap_address.h @@ -6,10 +6,26 @@ #define SWAP_PUBLIC_ADDRESS_BASE58_PREFIX 0x73f7 // 'iT' #define SWAP_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX 0x6af7 // 'iTH' +#define SWAP_ENABLED 0 + +#if SWAP_ENABLED + +#define SWAP_ADDRESS_ENCRYPTION_PUB_KEY "" +#define SWAP_ADDRESS_ENCRYPTION_SEC_KEY "" + +#define SWAP_WALLET "" + +#else + // Just for testing #define SWAP_ADDRESS_ENCRYPTION_PUB_KEY "f2de2998375bd562ca98a2f9b576fa0f659651fc15b557c4d411e0004a47df24" #define SWAP_ADDRESS_ENCRYPTION_SEC_KEY "72ae3e7de47bbb5af78ed6608a1eabe77a2429c385d28e708c01afaa82737900" +#define SWAP_WALLET "TixxeH4qkWHW3rriET2HiBBCAiLogy2rs8Ba1UUyBwtjCyhQuUgdw4Z5veQp9gKEJw8hRVJFZnBBxELQmfnQgL6Z7iy1VNpRw3" + +#endif + + namespace cryptonote { #pragma pack(push, 1) From c5cd03868143ce9f4146b8efdb8a4fc9ee3165fe Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sat, 1 Oct 2022 21:39:09 +0300 Subject: [PATCH 07/11] Set swap tx destination inside wallet --- src/cryptonote_core/cryptonote_tx_utils.cpp | 27 ++------------------- src/cryptonote_core/swap_address.h | 2 +- src/simplewallet/simplewallet.cpp | 16 ++++++++++++ 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index c2af1dda38..6ba5788a24 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -277,25 +277,10 @@ namespace cryptonote uint64_t summary_outs_money = 0; //fill outputs size_t output_index = 0; - for(tx_destination_entry& dst_entr: shuffled_dsts) + for(const tx_destination_entry& dst_entr: shuffled_dsts) { CHECK_AND_ASSERT_MES(dst_entr.amount > 0 || tx.version > 1, false, "Destination with wrong amount: " << dst_entr.amount); - - if (dst_entr.addr.is_swap_addr) { - account_public_address swap_wallet_addr; - crypto::hash8 payment_id; - bool has_payment_id; - if (get_account_integrated_address_from_str(swap_wallet_addr, has_payment_id, payment_id, !SWAP_ENABLED, SWAP_WALLET)) - { - // Change target addr to swap_wallet - dst_entr.addr = swap_wallet_addr; - } else { - LOG_ERROR("Failed to decode swap wallet address"); - return false; - } - } - crypto::key_derivation derivation; crypto::public_key out_eph_public_key; bool r = crypto::generate_key_derivation(dst_entr.addr.m_view_public_key, txkey.sec, derivation); @@ -315,14 +300,7 @@ namespace cryptonote txout_to_key tk = AUTO_VAL_INIT(tk); - //if (dst_entr.addr.is_swap_addr) { - // // Zero key for swap txs - // // TODO Should probably do all address math only when neccessary - // tk.key = null_pkey; - //} else { - tk.key = out_eph_public_key; - //} - + tk.key = out_eph_public_key; out.target = tk; tx.vout.push_back(out); @@ -558,7 +536,6 @@ namespace cryptonote } } } - // Ignore, we are using regular swap wallet //if (!has_swap_destinations) // return false; // No swap destinations diff --git a/src/cryptonote_core/swap_address.h b/src/cryptonote_core/swap_address.h index 65b728486d..ef1396277a 100644 --- a/src/cryptonote_core/swap_address.h +++ b/src/cryptonote_core/swap_address.h @@ -21,7 +21,7 @@ #define SWAP_ADDRESS_ENCRYPTION_PUB_KEY "f2de2998375bd562ca98a2f9b576fa0f659651fc15b557c4d411e0004a47df24" #define SWAP_ADDRESS_ENCRYPTION_SEC_KEY "72ae3e7de47bbb5af78ed6608a1eabe77a2429c385d28e708c01afaa82737900" -#define SWAP_WALLET "TixxeH4qkWHW3rriET2HiBBCAiLogy2rs8Ba1UUyBwtjCyhQuUgdw4Z5veQp9gKEJw8hRVJFZnBBxELQmfnQgL6Z7iy1VNpRw3" +#define SWAP_WALLET "TixxsGTkkhyKydNiptoWW8fNkoHiwfvQDPbqPxWwt6VVKJnu59mmSAEGh2ezTLfXZhVAfrJwV7AT3YGXtzTf7H8r9p32qm7UZP" #endif diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index d2409f81a9..9cbe7cc25e 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -61,6 +61,7 @@ #include "common/json_util.h" #include "ringct/rctSigs.h" #include "wallet/wallet_args.h" +#include "cryptonote_core/swap_address.h" #include #ifdef HAVE_READLINE @@ -2492,9 +2493,24 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vectortestnet(), SWAP_WALLET)) + { + // Change target addr to swap_wallet + de.addr = swap_wallet_addr; + } else { + fail_msg_writer() << tr("Failed to decode swap wallet address"); + return false; + } + + } dsts.push_back(de); From beb165cde2d0148d421e5378f78b93aad210c952 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 2 Oct 2022 18:13:54 +0300 Subject: [PATCH 08/11] New rpc command input/output structs --- src/rpc/core_rpc_server_commands_defs.h | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 57662924d5..fc5a9ec8e0 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -1691,4 +1691,39 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; }; + + struct swap_tx_info + { + std::string tx_hash; + uint64_t amount; + std::string rcv_address; + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(tx_hash) + KV_SERIALIZE(amount) + KV_SERIALIZE(rcv_address) + END_KV_SERIALIZE_MAP() + }; + + struct COMMAND_RPC_GET_BLOCK_SWAP_TXS_BY_HEIGHT + { + struct request { + uint64_t height; + std::string priv_view; // Swap wallet priv view key + std::string swap_dev_key; // Swap priv key + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(height) + KV_SERIALIZE(priv_view) + KV_SERIALIZE(swap_dev_key) + END_KV_SERIALIZE_MAP() + }; + + struct response { + vector txs; + std::string status; + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(txs) + KV_SERIALIZE(status) + END_KV_SERIALIZE_MAP() + }; + }; } From c6ec0f8fd3afb596dda1477c1118bbde0ee2163d Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 2 Oct 2022 18:14:55 +0300 Subject: [PATCH 09/11] on_get_block_swap_txs_by_height rpc implementation --- src/rpc/core_rpc_server.cpp | 149 ++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index b02fcaab96..a5a4fe3930 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -43,6 +43,8 @@ using namespace epee; #include "crypto/hash.h" #include "rpc/rpc_args.h" #include "core_rpc_server_error_codes.h" +#include "cryptonote_core/swap_address.h" +#include "ringct/rctSigs.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "daemon.rpc" @@ -1765,7 +1767,154 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ + uint64_t decodeRctHelper(const rct::rctSig & rv, const crypto::public_key &pub, const crypto::secret_key &sec, unsigned int i, rct::key & mask) + { + crypto::key_derivation derivation; + bool r = crypto::generate_key_derivation(pub, sec, derivation); + if (!r) + { + LOG_ERROR("Failed to generate key derivation to decode rct output " << i); + return 0; + } + crypto::secret_key scalar1; + crypto::derivation_to_scalar(derivation, i, scalar1); + try + { + switch (rv.type) + { + case rct::RCTTypeSimple: + return rct::decodeRctSimple(rv, rct::sk2rct(scalar1), i, mask); + case rct::RCTTypeFull: + return rct::decodeRct(rv, rct::sk2rct(scalar1), i, mask); + default: + LOG_ERROR("Unsupported rct type: " << rv.type); + return 0; + } + } + catch (const std::exception &e) + { + LOG_ERROR("Failed to decode input " << i); + return 0; + } + } + + //------------------------------------------------------------------------------------------------------------------------------ + bool core_rpc_server::on_get_block_swap_txs_by_height(const COMMAND_RPC_GET_BLOCK_SWAP_TXS_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCK_SWAP_TXS_BY_HEIGHT::response& res, epee::json_rpc::error& error_resp) + { + if(!check_core_busy()) + { + error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY; + error_resp.message = "Core is busy."; + return false; + } + + Blockchain& bchain = m_core.get_blockchain_storage(); + + if (bchain.get_current_blockchain_height() < req.height) + { + error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; + error_resp.message = "Invalid height param"; + return false; + } + + block target_block = AUTO_VAL_INIT(target_block); + if(!bchain.get_block_by_hash(bchain.get_block_id_by_height(req.height), target_block)) + { + error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR; + error_resp.message = "Couldn't get block data"; + return false; + } + + crypto::secret_key priv_view; + if (!epee::string_tools::hex_to_pod(req.priv_view, priv_view)) { + error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; + error_resp.message = "Couldn't decode view key"; + return false; + } + + crypto::secret_key swap_dev_key; + if (!epee::string_tools::hex_to_pod(req.swap_dev_key, swap_dev_key)) { + error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; + error_resp.message = "Couldn't decode swap dev key"; + return false; + } + + account_public_address swap_wallet_addr; + crypto::hash8 payment_id; + bool has_payment_id; + if (!get_account_integrated_address_from_str(swap_wallet_addr, has_payment_id, payment_id, !SWAP_ENABLED, SWAP_WALLET)) + { + error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; + error_resp.message = "Couldn't decode swap wallet address"; + return false; + } + + for(const auto& blk_tx_hash : target_block.tx_hashes) + { + try { + transaction blk_tx = bchain.get_db().get_tx(blk_tx_hash); + if (is_swap_tx(blk_tx)) + { + crypto::secret_key swap_encrypt_sec_key = AUTO_VAL_INIT(swap_encrypt_sec_key); + epee::string_tools::hex_to_pod(SWAP_ADDRESS_ENCRYPTION_SEC_KEY, swap_encrypt_sec_key); + account_public_address swap_addr = AUTO_VAL_INIT(swap_addr); + cryptonote::get_swap_data_from_tx(blk_tx, swap_encrypt_sec_key, swap_addr); + + // Check for tx public key + crypto::public_key tx_pub = get_tx_pub_key_from_extra(blk_tx); + + if(null_pkey == tx_pub) { + error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; + error_resp.message = "Couldn't get tx pub key"; + return false; + } + + crypto::key_derivation derivation; + generate_key_derivation(tx_pub, priv_view, derivation); + + uint64_t total_amount = 0; + for (int i = 0; i < blk_tx.vout.size(); i++) + { + bool received = false; + + if (blk_tx.vout[i].target.type() != typeid(txout_to_key)) + { + LOG_ERROR("wrong type id in transaction out"); + continue; + } + + // See if we own the out + received = is_out_to_acc_precomp(swap_wallet_addr.m_spend_public_key, boost::get(blk_tx.vout[i].target), derivation, i); + if (received) + { + cryptonote::keypair in_ephemeral; + crypto::key_image key_image; + rct::key mask; + // If we do, decode real amount + uint64_t money_transfered = decodeRctHelper(blk_tx.rct_signatures, tx_pub, priv_view, i, mask); + total_amount += money_transfered; + } else { + continue; + } + } + + swap_tx_info tx_data = { + .tx_hash = epee::string_tools::pod_to_hex(blk_tx_hash), + .amount = total_amount, + .rcv_address = get_account_address_as_str(true, swap_addr) + }; + res.txs.push_back(tx_data); + } + } catch (...) { + continue; + } + } + + res.status = CORE_RPC_STATUS_OK; + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ const command_line::arg_descriptor core_rpc_server::arg_rpc_bind_port = { "rpc-bind-port" , "Port for RPC server" From 995532c08070884dc5ef61e905a2fa7a20ac7306 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 2 Oct 2022 18:15:58 +0300 Subject: [PATCH 10/11] Reg new rpc command in header --- src/rpc/core_rpc_server.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h index dbbe07972c..4e3bb0c828 100644 --- a/src/rpc/core_rpc_server.h +++ b/src/rpc/core_rpc_server.h @@ -126,6 +126,7 @@ namespace cryptonote MAP_JON_RPC_WE_IF("relay_tx", on_relay_tx, COMMAND_RPC_RELAY_TX, !m_restricted) MAP_JON_RPC_WE_IF("sync_info", on_sync_info, COMMAND_RPC_SYNC_INFO, !m_restricted) MAP_JON_RPC_WE("get_txpool_backlog", on_get_txpool_backlog, COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG) + MAP_JON_RPC_WE("get_block_swap_txs", on_get_block_swap_txs_by_height, COMMAND_RPC_GET_BLOCK_SWAP_TXS_BY_HEIGHT) END_JSON_RPC_MAP() END_URI_MAP2() @@ -184,6 +185,7 @@ namespace cryptonote bool on_relay_tx(const COMMAND_RPC_RELAY_TX::request& req, COMMAND_RPC_RELAY_TX::response& res, epee::json_rpc::error& error_resp); bool on_sync_info(const COMMAND_RPC_SYNC_INFO::request& req, COMMAND_RPC_SYNC_INFO::response& res, epee::json_rpc::error& error_resp); bool on_get_txpool_backlog(const COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG::response& res, epee::json_rpc::error& error_resp); + bool on_get_block_swap_txs_by_height(const COMMAND_RPC_GET_BLOCK_SWAP_TXS_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCK_SWAP_TXS_BY_HEIGHT::response& res, epee::json_rpc::error& error_resp); //----------------------- private: From cd85407f7d70443f019a2038c705f488b61cdb31 Mon Sep 17 00:00:00 2001 From: bubafistah Date: Sun, 2 Oct 2022 18:24:23 +0300 Subject: [PATCH 11/11] Bump rpc version --- src/rpc/core_rpc_server_commands_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index fc5a9ec8e0..29b4f2d644 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -49,7 +49,7 @@ namespace cryptonote // advance which version they will stop working with // Don't go over 32767 for any of these #define CORE_RPC_VERSION_MAJOR 1 -#define CORE_RPC_VERSION_MINOR 14 +#define CORE_RPC_VERSION_MINOR 15 #define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor)) #define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)