Merge branch 'carrot-integration' of https://github.com/salvium/salvium into carrot-integration

This commit is contained in:
Some Random Crypto Guy
2025-07-15 16:05:31 +01:00
3 changed files with 7 additions and 7 deletions

View File

@@ -235,13 +235,14 @@ static std::optional<enote_view_incoming_scan_info_t> view_incoming_scan_pre_car
//j
const carrot::subaddress_index_extended subaddr_index{
.index = {receive_info->index.major, receive_info->index.minor},
.derive_type = carrot::AddressDeriveType::PreCarrot
.derive_type = carrot::AddressDeriveType::PreCarrot,
.is_return_spend_key = true
};
// HERE BE DRAGONS!!!
// SRCG: whilst the following code will work, it'd be better being moved to the TX_BUILDER code
// add the entry to our subaddress map in case it's a change payment (false positives won't hurt us)
account.get_subaddress_map_ref().insert({enote.onetime_address, subaddr_index});
account.insert_subaddresses({{enote.onetime_address, subaddr_index}});
// LAND AHOY!!!
return enote_view_incoming_scan_info_t{

View File

@@ -184,7 +184,7 @@ static crypto::public_key find_change_address_spend_pubkey(
const auto change_it_2 = std::find_if(std::next(change_it), subaddress_map.cend(),
[subaddr_account](const auto &p) { return p.second.major == subaddr_account && p.second.minor == 0; });
CHECK_AND_ASSERT_THROW_MES(change_it_2 == subaddress_map.cend(),
"find_change_address_spend_pubkey: provided subaddress map is malformed!!! At least two spend pubkeys map to "
"find_change_address_spend_pubkey: provided CN subaddress map is malformed!!! At least two spend pubkeys map to "
"index " << subaddr_account << ",0 in the subaddress map!");
return change_it->first;
@@ -981,7 +981,7 @@ cryptonote::transaction finalize_all_proofs_from_transfer_details(
<< n_inputs << "-in " << n_outputs << "-out, with "
<< tx_proposal.normal_payment_proposals.size() << " normal payment proposals, "
<< tx_proposal.selfsend_payment_proposals.size() << " self-send payment proposals, and a fee of "
<< tx_proposal.fee << " pXMR");
<< cryptonote::print_money(tx_proposal.fee) << " SAL1");
wallet2::transfer_container transfers;
w.get_transfers(transfers);
@@ -1094,7 +1094,7 @@ cryptonote::transaction finalize_all_proofs_from_transfer_details(
sid.origin_tx_type = src.origin_tx_data.tx_type;
bool r = cryptonote::generate_key_image_helper(
w.get_account().get_keys(),
w.get_subaddress_map_ref(),
w.get_account().get_subaddress_map_cn(),
out_key,
src.real_out_tx_key,
src.real_out_additional_tx_keys,

View File

@@ -2840,7 +2840,7 @@ void wallet2::process_new_scanned_transaction(
{
// save the change output key in our subaddress_map, so we can receive money to it later
// from protocol or return txs
for (const auto entry: tx_amounts_individual_outs[i->first]) {
for (const auto &entry: tx_amounts_individual_outs[i->first]) {
const crypto::public_key &onetime_address = std::get<1>(entry);
carrot::AddressDeriveType derive_type;
if (use_fork_rules(HF_VERSION_CARROT, 0)) {
@@ -2849,7 +2849,6 @@ void wallet2::process_new_scanned_transaction(
derive_type = carrot::AddressDeriveType::PreCarrot;
}
const carrot::subaddress_index_extended subaddr_ext = {i->first.major, i->first.minor, derive_type, true};
m_account.insert_subaddresses({{onetime_address, subaddr_ext}});
// save to m_subaddresses as well, so that we can populate account subaddress map
// when we open the wallet first time.
m_subaddresses_extended[onetime_address] = subaddr_ext;