mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
Merge pull request #3992
25c15dc
wallet2: use correct fee for split txes (stoffu)
This commit is contained in:
commit
c28a2b0d7d
1 changed files with 14 additions and 6 deletions
|
@ -7566,8 +7566,11 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||||
cryptonote::transaction tx;
|
cryptonote::transaction tx;
|
||||||
pending_tx ptx;
|
pending_tx ptx;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
|
uint64_t needed_fee;
|
||||||
std::vector<std::vector<tools::wallet2::get_outs_entry>> outs;
|
std::vector<std::vector<tools::wallet2::get_outs_entry>> outs;
|
||||||
|
|
||||||
|
TX() : bytes(0), needed_fee(0) {}
|
||||||
|
|
||||||
void add(const account_public_address &addr, bool is_subaddress, uint64_t amount, unsigned int original_output_index, bool merge_destinations) {
|
void add(const account_public_address &addr, bool is_subaddress, uint64_t amount, unsigned int original_output_index, bool merge_destinations) {
|
||||||
if (merge_destinations)
|
if (merge_destinations)
|
||||||
{
|
{
|
||||||
|
@ -7960,6 +7963,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||||
tx.ptx = test_ptx;
|
tx.ptx = test_ptx;
|
||||||
tx.bytes = txBlob.size();
|
tx.bytes = txBlob.size();
|
||||||
tx.outs = outs;
|
tx.outs = outs;
|
||||||
|
tx.needed_fee = needed_fee;
|
||||||
accumulated_fee += test_ptx.fee;
|
accumulated_fee += test_ptx.fee;
|
||||||
accumulated_change += test_ptx.change_dts.amount;
|
accumulated_change += test_ptx.change_dts.amount;
|
||||||
adding_fee = false;
|
adding_fee = false;
|
||||||
|
@ -8011,7 +8015,7 @@ skip_tx:
|
||||||
fake_outs_count, /* CONST size_t fake_outputs_count, */
|
fake_outs_count, /* CONST size_t fake_outputs_count, */
|
||||||
tx.outs, /* MOD std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, */
|
tx.outs, /* MOD std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, */
|
||||||
unlock_time, /* CONST uint64_t unlock_time, */
|
unlock_time, /* CONST uint64_t unlock_time, */
|
||||||
needed_fee, /* CONST uint64_t fee, */
|
tx.needed_fee, /* CONST uint64_t fee, */
|
||||||
extra, /* const std::vector<uint8_t>& extra, */
|
extra, /* const std::vector<uint8_t>& extra, */
|
||||||
test_tx, /* OUT cryptonote::transaction& tx, */
|
test_tx, /* OUT cryptonote::transaction& tx, */
|
||||||
test_ptx, /* OUT cryptonote::transaction& tx, */
|
test_ptx, /* OUT cryptonote::transaction& tx, */
|
||||||
|
@ -8022,7 +8026,7 @@ skip_tx:
|
||||||
fake_outs_count,
|
fake_outs_count,
|
||||||
tx.outs,
|
tx.outs,
|
||||||
unlock_time,
|
unlock_time,
|
||||||
needed_fee,
|
tx.needed_fee,
|
||||||
extra,
|
extra,
|
||||||
detail::digit_split_strategy,
|
detail::digit_split_strategy,
|
||||||
tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD),
|
tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD),
|
||||||
|
@ -8043,7 +8047,7 @@ skip_tx:
|
||||||
for (size_t idx: tx.selected_transfers)
|
for (size_t idx: tx.selected_transfers)
|
||||||
tx_money += m_transfers[idx].amount();
|
tx_money += m_transfers[idx].amount();
|
||||||
LOG_PRINT_L1(" Transaction " << (1+std::distance(txes.begin(), i)) << "/" << txes.size() <<
|
LOG_PRINT_L1(" Transaction " << (1+std::distance(txes.begin(), i)) << "/" << txes.size() <<
|
||||||
": " << get_size_string(tx.bytes) << ", sending " << print_money(tx_money) << " in " << tx.selected_transfers.size() <<
|
" " << get_transaction_hash(tx.ptx.tx) << ": " << get_size_string(tx.bytes) << ", sending " << print_money(tx_money) << " in " << tx.selected_transfers.size() <<
|
||||||
" outputs to " << tx.dsts.size() << " destination(s), including " <<
|
" outputs to " << tx.dsts.size() << " destination(s), including " <<
|
||||||
print_money(tx.ptx.fee) << " fee, " << print_money(tx.ptx.change_dts.amount) << " change");
|
print_money(tx.ptx.fee) << " fee, " << print_money(tx.ptx.change_dts.amount) << " change");
|
||||||
ptx_vector.push_back(tx.ptx);
|
ptx_vector.push_back(tx.ptx);
|
||||||
|
@ -8142,7 +8146,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
||||||
cryptonote::transaction tx;
|
cryptonote::transaction tx;
|
||||||
pending_tx ptx;
|
pending_tx ptx;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
|
uint64_t needed_fee;
|
||||||
std::vector<std::vector<get_outs_entry>> outs;
|
std::vector<std::vector<get_outs_entry>> outs;
|
||||||
|
|
||||||
|
TX() : bytes(0), needed_fee(0) {}
|
||||||
};
|
};
|
||||||
std::vector<TX> txes;
|
std::vector<TX> txes;
|
||||||
uint64_t needed_fee, available_for_fee = 0;
|
uint64_t needed_fee, available_for_fee = 0;
|
||||||
|
@ -8240,6 +8247,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
||||||
tx.ptx = test_ptx;
|
tx.ptx = test_ptx;
|
||||||
tx.bytes = txBlob.size();
|
tx.bytes = txBlob.size();
|
||||||
tx.outs = outs;
|
tx.outs = outs;
|
||||||
|
tx.needed_fee = needed_fee;
|
||||||
accumulated_fee += test_ptx.fee;
|
accumulated_fee += test_ptx.fee;
|
||||||
accumulated_change += test_ptx.change_dts.amount;
|
accumulated_change += test_ptx.change_dts.amount;
|
||||||
if (!unused_transfers_indices.empty() || !unused_dust_indices.empty())
|
if (!unused_transfers_indices.empty() || !unused_dust_indices.empty())
|
||||||
|
@ -8260,10 +8268,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
||||||
cryptonote::transaction test_tx;
|
cryptonote::transaction test_tx;
|
||||||
pending_tx test_ptx;
|
pending_tx test_ptx;
|
||||||
if (use_rct) {
|
if (use_rct) {
|
||||||
transfer_selected_rct(tx.dsts, tx.selected_transfers, fake_outs_count, tx.outs, unlock_time, needed_fee, extra,
|
transfer_selected_rct(tx.dsts, tx.selected_transfers, fake_outs_count, tx.outs, unlock_time, tx.needed_fee, extra,
|
||||||
test_tx, test_ptx, bulletproof);
|
test_tx, test_ptx, bulletproof);
|
||||||
} else {
|
} else {
|
||||||
transfer_selected(tx.dsts, tx.selected_transfers, fake_outs_count, tx.outs, unlock_time, needed_fee, extra,
|
transfer_selected(tx.dsts, tx.selected_transfers, fake_outs_count, tx.outs, unlock_time, tx.needed_fee, extra,
|
||||||
detail::digit_split_strategy, tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD), test_tx, test_ptx);
|
detail::digit_split_strategy, tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD), test_tx, test_ptx);
|
||||||
}
|
}
|
||||||
auto txBlob = t_serializable_object_to_blob(test_ptx.tx);
|
auto txBlob = t_serializable_object_to_blob(test_ptx.tx);
|
||||||
|
@ -8280,7 +8288,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
||||||
for (size_t idx: tx.selected_transfers)
|
for (size_t idx: tx.selected_transfers)
|
||||||
tx_money += m_transfers[idx].amount();
|
tx_money += m_transfers[idx].amount();
|
||||||
LOG_PRINT_L1(" Transaction " << (1+std::distance(txes.begin(), i)) << "/" << txes.size() <<
|
LOG_PRINT_L1(" Transaction " << (1+std::distance(txes.begin(), i)) << "/" << txes.size() <<
|
||||||
": " << get_size_string(tx.bytes) << ", sending " << print_money(tx_money) << " in " << tx.selected_transfers.size() <<
|
" " << get_transaction_hash(tx.ptx.tx) << ": " << get_size_string(tx.bytes) << ", sending " << print_money(tx_money) << " in " << tx.selected_transfers.size() <<
|
||||||
" outputs to " << tx.dsts.size() << " destination(s), including " <<
|
" outputs to " << tx.dsts.size() << " destination(s), including " <<
|
||||||
print_money(tx.ptx.fee) << " fee, " << print_money(tx.ptx.change_dts.amount) << " change");
|
print_money(tx.ptx.fee) << " fee, " << print_money(tx.ptx.change_dts.amount) << " change");
|
||||||
ptx_vector.push_back(tx.ptx);
|
ptx_vector.push_back(tx.ptx);
|
||||||
|
|
Loading…
Reference in a new issue