mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
wallet2: fix wrong change being recorded for cold signed txes
This commit is contained in:
parent
dbf2ab56c5
commit
92dea04929
2 changed files with 11 additions and 3 deletions
|
@ -2730,7 +2730,7 @@ void wallet2::add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amo
|
|||
utd.m_amount_out = 0;
|
||||
for (const auto &d: dests)
|
||||
utd.m_amount_out += d.amount;
|
||||
utd.m_amount_out += change_amount;
|
||||
utd.m_amount_out += change_amount; // dests does not contain change
|
||||
utd.m_change = change_amount;
|
||||
utd.m_sent_time = time(NULL);
|
||||
utd.m_tx = (const cryptonote::transaction_prefix&)tx;
|
||||
|
@ -3057,7 +3057,7 @@ bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &s
|
|||
ptx.change_dts = sd.change_dts;
|
||||
ptx.selected_transfers = sd.selected_transfers;
|
||||
ptx.tx_key = rct::rct2sk(rct::identity()); // don't send it back to the untrusted view wallet
|
||||
ptx.dests = sd.splitted_dsts;
|
||||
ptx.dests = sd.dests;
|
||||
ptx.construction_data = sd;
|
||||
|
||||
txs.push_back(ptx);
|
||||
|
@ -3656,6 +3656,7 @@ void wallet2::transfer_selected(const std::vector<cryptonote::tx_destination_ent
|
|||
ptx.construction_data.extra = tx.extra;
|
||||
ptx.construction_data.unlock_time = unlock_time;
|
||||
ptx.construction_data.use_rct = false;
|
||||
ptx.construction_data.dests = dsts;
|
||||
}
|
||||
|
||||
void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry> dsts, const std::list<size_t> selected_transfers, size_t fake_outputs_count,
|
||||
|
@ -3776,6 +3777,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
|
|||
ptx.construction_data.extra = tx.extra;
|
||||
ptx.construction_data.unlock_time = unlock_time;
|
||||
ptx.construction_data.use_rct = true;
|
||||
ptx.construction_data.dests = dsts;
|
||||
}
|
||||
|
||||
static size_t estimate_rct_tx_size(int n_inputs, int mixin, int n_outputs)
|
||||
|
|
|
@ -191,11 +191,12 @@ namespace tools
|
|||
{
|
||||
std::vector<cryptonote::tx_source_entry> sources;
|
||||
cryptonote::tx_destination_entry change_dts;
|
||||
std::vector<cryptonote::tx_destination_entry> splitted_dsts;
|
||||
std::vector<cryptonote::tx_destination_entry> splitted_dsts; // split, includes change
|
||||
std::list<size_t> selected_transfers;
|
||||
std::vector<uint8_t> extra;
|
||||
uint64_t unlock_time;
|
||||
bool use_rct;
|
||||
std::vector<cryptonote::tx_destination_entry> dests; // original setup, does not include change
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(sources)
|
||||
|
@ -205,12 +206,16 @@ namespace tools
|
|||
FIELD(extra)
|
||||
VARINT_FIELD(unlock_time)
|
||||
FIELD(use_rct)
|
||||
FIELD(dests)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
typedef std::vector<transfer_details> transfer_container;
|
||||
typedef std::unordered_multimap<crypto::hash, payment_details> payment_container;
|
||||
|
||||
// The convention for destinations is:
|
||||
// dests does not include change
|
||||
// splitted_dsts (in construction_data) does
|
||||
struct pending_tx
|
||||
{
|
||||
cryptonote::transaction tx;
|
||||
|
@ -1047,6 +1052,7 @@ namespace tools
|
|||
ptx.construction_data.extra = tx.extra;
|
||||
ptx.construction_data.unlock_time = unlock_time;
|
||||
ptx.construction_data.use_rct = false;
|
||||
ptx.construction_data.dests = dsts;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue