Construct LNS txes with no destination (the way the wallet does)

This commit is contained in:
Jason Rhinelander 2020-09-16 15:03:20 -03:00
parent 8c12ed13b0
commit 82514b9956

View file

@ -1329,10 +1329,18 @@ public:
std::vector<cryptonote::tx_destination_entry> destinations;
uint64_t change_amount;
// TODO(loki): Eww we still depend on monero land test code
const auto nmix = 9;
fill_tx_sources_and_destinations(
m_events, m_head, m_from, m_to, m_amount, m_fee, nmix, sources, destinations, &change_amount);
constexpr size_t nmix = 9;
if (m_tx_params.tx_type == cryptonote::txtype::loki_name_system) // LNS txes only have change
{
fill_tx_sources_and_multi_destinations(
m_events, m_head, m_from, m_to, nullptr /*amounts*/, 0 /*num_amounts*/, m_fee, nmix, sources, destinations, true /*add change*/, &change_amount);
}
else
{
// TODO(loki): Eww we still depend on monero land test code
fill_tx_sources_and_destinations(
m_events, m_head, m_from, m_to, m_amount, m_fee, nmix, sources, destinations, &change_amount);
}
cryptonote::tx_destination_entry change_addr{ change_amount, m_from.get_keys().m_account_address, false /*is_subaddr*/ };
bool result = cryptonote::construct_tx(