From f04598fea7406fa4178ec5ae70cb38ffc4fe694c Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Fri, 8 Mar 2024 01:05:08 +0100 Subject: [PATCH] fixed transaction priority --- Makefile | 2 +- libbridge/src/main/cpp/wallet2_api_c.cpp | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c3abae6..5fa37cc 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ download: # A general rule of thumb is that `make depends_host` works everywhere, but not everything # is required. But since we target so many different OS.. yeah. .PHONY: depends_host -depends_host: libiconv_host boost_host zlib_host openssl_host openssl_host_alt libzmq_host libsodium_host host_copy_libs libexpat_host unbound_host polyseed_host utf8proc_host +depends_host: libiconv_host boost_host zlib_host openssl_host openssl_host_alt libzmq_host libsodium_host host_copy_libs libexpat_host unbound_host polyseed_host utf8proc_host host_copy_libs .PHONY: host_copy_libs host_copy_libs: diff --git a/libbridge/src/main/cpp/wallet2_api_c.cpp b/libbridge/src/main/cpp/wallet2_api_c.cpp index c7d1570..8277858 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.cpp +++ b/libbridge/src/main/cpp/wallet2_api_c.cpp @@ -1166,6 +1166,17 @@ const char* MONERO_Wallet_getMultisigInfo(void* wallet_ptr) { memcpy(buffer, str.c_str(), size + 1); return buffer; } + +Monero::PendingTransaction::Priority PendingTransaction_Priority_fromInt(int value) { + switch(value) { + case 0: return Monero::PendingTransaction::Priority::Priority_Default; + case 1: return Monero::PendingTransaction::Priority::Priority_Low; + case 2: return Monero::PendingTransaction::Priority::Priority_Medium; + case 3: return Monero::PendingTransaction::Priority::Priority_High; + default: return Monero::PendingTransaction::Priority::Priority_Default; + } +} + void* MONERO_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id, uint64_t amount, uint32_t mixin_count, int pendingTransactionPriority, @@ -1178,16 +1189,14 @@ void* MONERO_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, co } std::set subaddr_indices = {}; std::set preferred_inputs = splitString(std::string(preferredInputs), std::string(separator)); - wallet->info("MONERO_C", "TEST"); - wallet->info("MONERO_C", preferredInputs); - wallet->info("MONERO_C", std::to_string(preferred_inputs.size())); auto oneInput = *(preferred_inputs.begin()); - wallet->info("MONERO_C", oneInput); return wallet->createTransaction(std::string(dst_addr), std::string(payment_id), optAmount, mixin_count, - Monero::PendingTransaction::Priority_Low, + PendingTransaction_Priority_fromInt(pendingTransactionPriority), subaddr_account, subaddr_indices, preferred_inputs); } + + void* MONERO_Wallet_loadUnsignedTx(void* wallet_ptr, const char* fileName) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->loadUnsignedTx(std::string(fileName));