Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ac0ee61
wallet: guard the sender field of a light wallet response
mycomputercrashsalot Nov 16, 2026
3fd8553
wallet: keep the server's amounts for spends a view-only wallet canno…
mycomputercrashsalot Nov 16, 2026
9f85f0a
wallet: refuse a daemon connection on a light wallet
mycomputercrashsalot Nov 16, 2026
c9b1e6f
wallet: report the transactions that a failed relay already sent
mycomputercrashsalot Nov 16, 2026
18ff842
wallet: guard the sender of a spend in the transfers of a light wallet
mycomputercrashsalot Nov 16, 2026
097f308
wallet: report a transaction that relayed but is not tracked
mycomputercrashsalot Nov 16, 2026
4731332
wallet: lock the listeners of a light wallet
mycomputercrashsalot Nov 16, 2026
2fb4ba2
wallet: lock the reads of a light wallet against its background sync
mycomputercrashsalot Nov 16, 2026
6350812
wallet: end a sync of a light wallet that changes nothing
mycomputercrashsalot Nov 16, 2026
b39bc3e
wallet: refuse an amount of a light wallet that its total cannot carry
mycomputercrashsalot Nov 16, 2026
3a4eb4c
model: default the recipient of a light wallet output to the primary …
mycomputercrashsalot Nov 16, 2026
cc1ec9d
utils: read a uint64 from the digits a string carries
mycomputercrashsalot Nov 16, 2026
57826ad
wallet: test a key image of a spend against every subaddress
mycomputercrashsalot Nov 16, 2026
b499709
wallet: default the fee of a light wallet transaction to none
mycomputercrashsalot Nov 16, 2026
a74895a
model: treat an output of a light wallet whose tx is missing as unlocked
mycomputercrashsalot Nov 16, 2026
cfc7881
wallet: give up on the next block of a light wallet after a minute
mycomputercrashsalot Nov 16, 2026
ea7a679
wallet: read the existence of a light wallet from a forbidden answer
mycomputercrashsalot Nov 16, 2026
91a94c4
wallet: say what a light wallet cannot check or scan
mycomputercrashsalot Nov 16, 2026
b62ea2d
wallet: free a light wallet when its factory throws
mycomputercrashsalot Nov 16, 2026
52b85b4
model: refuse an output index out of the range of a transaction
mycomputercrashsalot Nov 16, 2026
9312032
wallet: say a check of a tx key is not good when the address received…
mycomputercrashsalot Nov 16, 2026
4924d41
wallet: lock the transfers and subaddresses of a light wallet
mycomputercrashsalot Nov 16, 2026
6a5f141
wallet: report the transactions that a failed sweep already sent
mycomputercrashsalot Nov 16, 2026
3ea5712
wallet: read the state of a checked tx from the chain of a light wallet
mycomputercrashsalot Nov 16, 2026
bf760f7
utils: tell the change of a pending tx by its address
mycomputercrashsalot Nov 16, 2026
8685344
model: credit the change of a pending tx to the account that sent it
mycomputercrashsalot Nov 16, 2026
bcd6f42
model: keep the outputs of a light wallet frozen across a sync
mycomputercrashsalot Nov 16, 2026
f6942b9
model: export an output of a light wallet whose tx is missing
mycomputercrashsalot Nov 16, 2026
823469b
wallet: refuse a subaddress range a light wallet cannot carry
mycomputercrashsalot Nov 16, 2026
1d16295
wallet: guard the derivations and the sum of the inputs of a light wa…
mycomputercrashsalot Nov 16, 2026
e00397a
wallet: refuse a relay from a view-only light wallet
mycomputercrashsalot Nov 16, 2026
a7d4cbf
wallet: read the not relayed answer of a submit of a light wallet
mycomputercrashsalot Nov 16, 2026
d918f73
wallet: name no address of a rescan that a light wallet server does n…
mycomputercrashsalot Nov 16, 2026
6ceac72
wallet: sort the outputs of a light wallet by their amounts
mycomputercrashsalot Nov 16, 2026
3f8d797
wallet: count a subaddress range of a light wallet where it cannot wrap
mycomputercrashsalot Nov 17, 2026
8030cd1
wallet: report only the relayed txs of a failed sweep of a light wallet
mycomputercrashsalot Nov 17, 2026
c2cf2ec
wallet: read a derivation of an output of a light wallet inside its r…
mycomputercrashsalot Nov 17, 2026
097aa19
wallet: refuse a sweep that relays from a view-only light wallet
mycomputercrashsalot Nov 17, 2026
3b39772
model: report an output of a light wallet that a sync replaced as frozen
mycomputercrashsalot Nov 17, 2026
2e813c7
wallet: say a check of a tx key of an rpc wallet is not good when the…
mycomputercrashsalot Nov 17, 2026
624ff04
utils: drop an include that the digits of a uint64 do not need
mycomputercrashsalot Nov 17, 2026
7f99e4a
wallet: end the pause of a light wallet op before it tells its listeners
mycomputercrashsalot Nov 17, 2026
53031d4
wallet: recalculate the balances of a light wallet before its relay t…
mycomputercrashsalot Nov 17, 2026
f063bb3
wallet: keep the count of fetched blocks of a light wallet from wrapping
mycomputercrashsalot Nov 18, 2026
a26c03d
wallet: keep the fee mask of a light wallet from dividing by nothing
mycomputercrashsalot Nov 19, 2026
0c13f6f
wallet: sign the key images of a light wallet over their one-time keys
mycomputercrashsalot Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/utils/gen_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
#include <boost/property_tree/json_parser.hpp>
#include "rapidjson/document.h"
#include <boost/thread/recursive_mutex.hpp>
#include <algorithm>
#include <cctype>
#include <boost/thread/thread.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
Expand Down Expand Up @@ -91,27 +93,19 @@ namespace gen_utils
}

static bool is_uint64_t(const std::string& str) {
if (str.empty() || !std::all_of(str.begin(), str.end(), [](char c) { return std::isdigit(static_cast<unsigned char>(c)); })) return false;
try {
size_t sz;
std::stol(str, &sz);
std::stoull(str, &sz);
return sz == str.size();
}
catch (const std::invalid_argument&) {
// if no conversion could be performed.
return false;
}
catch (const std::out_of_range&) {
// if the converted value would fall out of the range of the result type.
return false;
}
catch (const std::invalid_argument&) { return false; }
catch (const std::out_of_range&) { return false; }
}

static uint64_t uint64_t_cast(const std::string& str) {
if (!is_uint64_t(str)) throw std::out_of_range("String provided is not a valid uint64_t");
uint64_t value;
std::istringstream itr(str);
itr >> value;
return value;
return std::stoull(str);
}

static uint64_t timestamp_to_epoch(const std::string& iso_timestamp) {
Expand Down
11 changes: 8 additions & 3 deletions src/utils/monero_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ bool monero_utils::parse_payment_id_short(const std::string& payment_id_str, cry
return true;
}

std::shared_ptr<monero_key_image> monero_utils::generate_key_image(const crypto::public_key &ephem_pubkey, const size_t tx_output_index, const cryptonote::subaddress_index &received_subaddr, const cryptonote::account_base& account) {
std::shared_ptr<monero_key_image> monero_utils::generate_key_image(const crypto::public_key &ephem_pubkey, const size_t tx_output_index, const cryptonote::subaddress_index &received_subaddr, const cryptonote::account_base& account, const boost::optional<crypto::public_key>& expected_output_pubkey) {
// - R: ephem_pubkey
// - a: ack.m_view_secret_key [private viewkey]
// - b: ack.m_spend_secret_key [private spendkey]
Expand Down Expand Up @@ -824,14 +824,19 @@ std::shared_ptr<monero_key_image> monero_utils::generate_key_image(const crypto:
crypto::public_key onetime_pubkey;
CHECK_AND_ASSERT_THROW_MES(hwdev.secret_key_to_public_key(onetime_privkey, onetime_pubkey), "Failed to make public key");

// the wallet derived the one-time key from the transaction key and its own, so a server that names
// another one-time key for the output says the wallet owns money that it does not
if (expected_output_pubkey != boost::none && onetime_pubkey != *expected_output_pubkey) throw std::runtime_error("The one-time key of the output does not match the one the wallet derived");

// 6. Key image I = x Hp(K)
crypto::key_image ki;
hwdev.generate_key_image(onetime_pubkey, onetime_privkey, ki);

// sign the key image with the output secret key
// sign the key image with the output secret key over the one-time key it spends: the verifier checks
// the signature against that key, and one over the transaction key would never verify
crypto::signature signature;
std::vector<const crypto::public_key*> key_ptrs;
key_ptrs.push_back(&ephem_pubkey);
key_ptrs.push_back(&onetime_pubkey);

crypto::generate_ring_signature((const crypto::hash&)ki, ki, key_ptrs, onetime_privkey, 0, &signature);

Expand Down
2 changes: 1 addition & 1 deletion src/utils/monero_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace monero_utils
* @param account recipient's account
* @return the generated key image
*/
std::shared_ptr<monero_key_image> generate_key_image(const crypto::public_key &ephem_pubkey, const size_t tx_output_index, const cryptonote::subaddress_index &received_subaddr, const cryptonote::account_base& account);
std::shared_ptr<monero_key_image> generate_key_image(const crypto::public_key &ephem_pubkey, const size_t tx_output_index, const cryptonote::subaddress_index &received_subaddr, const cryptonote::account_base& account, const boost::optional<crypto::public_key>& expected_output_pubkey = boost::none);

// ----------------------------- GATHER BLOCKS ------------------------------

Expand Down
4 changes: 3 additions & 1 deletion src/utils/monero_wallet_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ std::shared_ptr<monero_tx_wallet> monero_wallet_utils::ptx_to_tx(const tools::wa
output->m_subaddress_index = subaddress_idx;
output->m_is_spent = false;
output->m_is_frozen = false;
bool is_change = cd.change_dts.amount > 0 && dest.amount == cd.change_dts.amount && change_output == nullptr;
// the change is the output that pays the address of the change, and not the first one of its
// amount, which a destination can share: wallet2 tells them apart the same way
bool is_change = cd.change_dts.amount > 0 && dest.addr == cd.change_dts.addr && change_output == nullptr;
if (is_change) {
change_output = output;
}
Expand Down
4 changes: 3 additions & 1 deletion src/wallet/monero_wallet_full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3034,7 +3034,9 @@ namespace monero {
uint64_t num_confirmations;
m_w2->check_tx_key(_tx_hash, _tx_key, additional_tx_keys, info.address, received_amount, in_tx_pool, num_confirmations);
std::shared_ptr<monero_check_tx> check_tx = std::make_shared<monero_check_tx>();
check_tx->m_is_good = true; // check is good if we get this far
// a key that is not the one of the tx, or a tx that did not pay the address, receives nothing: the
// check says it is not good and not that it erred
check_tx->m_is_good = received_amount > 0;
check_tx->m_received_amount = received_amount;
check_tx->m_in_tx_pool = in_tx_pool;
check_tx->m_num_confirmations = num_confirmations;
Expand Down
Loading