aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/cryptonote_tx_utils.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-03 11:58:06 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-03 11:58:06 +0200
commit13a84caa2254a98ea1de35f2d9771d606411043c (patch)
treeaca9d1f4547a3ded0d1f32b0f454dad063a845ea /src/cryptonote_core/cryptonote_tx_utils.cpp
parent4146f2e202206e7c5e288a47254e6ea055dc686d (diff)
parent88ebfd646a5e75de0544958e88d152df86e310ec (diff)
downloadmonzero-core-13a84caa2254a98ea1de35f2d9771d606411043c.tar.gz
monzero-core-13a84caa2254a98ea1de35f2d9771d606411043c.tar.xz
monzero-core-13a84caa2254a98ea1de35f2d9771d606411043c.zip
Merge pull request #2662
88ebfd64 core_tests: fix for subaddress patch (kenshi84) e373a203 performance_tests: add master spend pubkey to subaddress hashtable (kenshi84)
Diffstat (limited to 'src/cryptonote_core/cryptonote_tx_utils.cpp')
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index 586df9079..96f6ee872 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -158,7 +158,7 @@ namespace cryptonote
return destinations[0].addr.m_view_public_key;
}
//---------------------------------------------------------------
- bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, const cryptonote::account_public_address& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct)
+ bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct)
{
if (destinations.empty())
{
@@ -301,7 +301,7 @@ namespace cryptonote
account_public_address single_dest_subaddress;
for(const tx_destination_entry& dst_entr: destinations)
{
- if (dst_entr.addr == change_addr)
+ if (change_addr && dst_entr.addr == *change_addr)
continue;
if (unique_dst_addresses.count(dst_entr.addr) == 0)
{
@@ -354,7 +354,7 @@ namespace cryptonote
}
bool r;
- if (dst_entr.addr == change_addr)
+ if (change_addr && dst_entr.addr == *change_addr)
{
// sending change to yourself; derivation = a*R
r = crypto::generate_key_derivation(txkey.pub, sender_account_keys.m_view_secret_key, derivation);
@@ -565,13 +565,13 @@ namespace cryptonote
return true;
}
//---------------------------------------------------------------
- bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time)
+ bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time)
{
std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
subaddresses[sender_account_keys.m_account_address.m_spend_public_key] = {0,0};
crypto::secret_key tx_key;
std::vector<crypto::secret_key> additional_tx_keys;
- return construct_tx_and_get_tx_key(sender_account_keys, subaddresses, sources, destinations, destinations.back().addr, extra, tx, unlock_time, tx_key, additional_tx_keys);
+ return construct_tx_and_get_tx_key(sender_account_keys, subaddresses, sources, destinations, change_addr, extra, tx, unlock_time, tx_key, additional_tx_keys);
}
//---------------------------------------------------------------
bool generate_genesis_block(