diff --git a/README.md b/README.md index e5b3de2..48de4bf 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This library may be used to build Monero-related applications, such as GUIs, lib ## Main Features - Manage Monero wallets which connect to a daemon -- Cohesive APIs and models with rigorous focus on ease-of-use +- Cohesive APIs and models with focus on ease-of-use - Query wallet transactions, transfers, and outputs by their attributes - Be notified when blocks are added to the chain, as the wallet synchronizes, or when the wallet sends or receives funds - Full multisig support @@ -187,7 +187,7 @@ This project is licensed under MIT. ## Donate -If you get value from this library, please consider donating. Thank you. +If you get value from this library, please consider donating. Thank you!

diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index b43435c..375e2dd 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -1159,23 +1159,14 @@ namespace monero { * Check a transaction in the blockchain with its secret key. * * @param tx_hash specifies the transaction to check - * @param txKey is the transaction's secret key + * @param tx_key is the transaction's secret key * @param address is the destination public address of the transaction * @return the result of the check */ - virtual shared_ptr check_tx_key(const string& tx_hash, const string& txKey, const string& address) const { + virtual shared_ptr check_tx_key(const string& tx_hash, const string& tx_key, const string& address) const { throw runtime_error("check_tx_key() not supported"); } -// /** -// * Get a transaction signature to prove it. -// * -// * @param tx_hash specifies the transaction to prove -// * @param address is the destination public address of the transaction -// * @return the transaction signature -// */ -// string get_tx_proof(const string& tx_hash, const string& address) const; - /** * Get a transaction signature to prove it. * @@ -1201,14 +1192,6 @@ namespace monero { throw runtime_error("check_tx_proof() not supported"); } -// /** -// * Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address. -// * -// * @param tx_hash specifies the transaction to prove -// * @return the transaction signature -// */ -// string get_spend_proof(const string& tx_hash) const; - /** * Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address. * diff --git a/src/wallet/monero_wallet_core.cpp b/src/wallet/monero_wallet_core.cpp index 780d2a0..3bedf7b 100644 --- a/src/wallet/monero_wallet_core.cpp +++ b/src/wallet/monero_wallet_core.cpp @@ -2579,22 +2579,28 @@ namespace monero { shared_ptr monero_wallet_core::check_tx_key(const string& tx_hash, const string& tx_key, const string& address) const { MTRACE("monero_wallet_core::check_tx_key()"); + cout << "check tx key 1" << endl; + // validate and parse tx hash crypto::hash _tx_hash; if (!epee::string_tools::hex_to_pod(tx_hash, _tx_hash)) { throw runtime_error("TX hash has invalid format"); } + cout << "check tx key 2" << endl; + // validate and parse tx key epee::wipeable_string tx_key_str = tx_key; if (tx_key_str.size() < 64 || tx_key_str.size() % 64) { throw runtime_error("Tx key has invalid format"); } + cout << "check tx key 3" << endl; const char *data = tx_key_str.data(); crypto::secret_key _tx_key; if (!epee::wipeable_string(data, 64).hex_to_pod(unwrap(unwrap(_tx_key)))) { throw runtime_error("Tx key has invalid format"); } + cout << "check tx key 4" << endl; // get additional keys size_t offset = 64; @@ -2606,24 +2612,30 @@ namespace monero { } offset += 64; } + cout << "check tx key 5" << endl; // validate and parse address cryptonote::address_parse_info info; if (!get_account_address_from_str(info, m_w2->nettype(), address)) { throw runtime_error("Invalid address"); } + cout << "check tx key 6" << endl; // initialize and return tx check using wallet2 uint64_t received_amount; bool in_tx_pool; uint64_t num_confirmations; + cout << "check tx key 7" << endl; m_w2->check_tx_key(_tx_hash, _tx_key, additional_tx_keys, info.address, received_amount, in_tx_pool, num_confirmations); - shared_ptr checkTx = make_shared(); - checkTx->m_is_good = true; // check is good if we get this far - checkTx->m_received_amount = received_amount; - checkTx->m_in_tx_pool = in_tx_pool; - checkTx->m_num_confirmations = num_confirmations; - return checkTx; + cout << "check tx key 8" << endl; + shared_ptr check_tx = make_shared(); + cout << "check tx key 9" << endl; + check_tx->m_is_good = true; // check is good if we get this far + check_tx->m_received_amount = received_amount; + check_tx->m_in_tx_pool = in_tx_pool; + check_tx->m_num_confirmations = num_confirmations; + cout << "check tx key 10" << endl; + return check_tx; } string monero_wallet_core::get_tx_proof(const string& tx_hash, const string& address, const string& message) const { @@ -2660,17 +2672,17 @@ namespace monero { } // initialize and return tx check using wallet2 - shared_ptr checkTx = make_shared(); + shared_ptr check_tx = make_shared(); uint64_t received_amount; bool in_tx_pool; uint64_t num_confirmations; - checkTx->m_is_good = m_w2->check_tx_proof(_tx_hash, info.address, info.is_subaddress, message, signature, received_amount, in_tx_pool, num_confirmations); - if (checkTx->m_is_good) { - checkTx->m_received_amount = received_amount; - checkTx->m_in_tx_pool = in_tx_pool; - checkTx->m_num_confirmations = num_confirmations; + check_tx->m_is_good = m_w2->check_tx_proof(_tx_hash, info.address, info.is_subaddress, message, signature, received_amount, in_tx_pool, num_confirmations); + if (check_tx->m_is_good) { + check_tx->m_received_amount = received_amount; + check_tx->m_in_tx_pool = in_tx_pool; + check_tx->m_num_confirmations = num_confirmations; } - return checkTx; + return check_tx; } string monero_wallet_core::get_spend_proof(const string& tx_hash, const string& message) const { diff --git a/test/sample_code.cpp b/test/sample_code.cpp index 397afbd..c94fb78 100644 --- a/test/sample_code.cpp +++ b/test/sample_code.cpp @@ -87,7 +87,7 @@ int main(int argc, const char* argv[]) { uint64_t random_height = wallet_random->get_height(); bool random_is_synced = wallet_random->is_synced(); - // be notified when the wallet receives funds + // receive notifications when the wallet receives funds struct : monero_wallet_listener { void on_output_received(const monero_output_wallet& output) { cout << "Wallet received funds!" << endl;