mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 07:18:53 +00:00
Add CoinsInfo->description and 'preferred_inputs' to create_transaction
This commit is contained in:
parent
c2d9ac9d16
commit
dad8e3cadd
@ -84,6 +84,7 @@ namespace Monero {
|
|||||||
ci->m_unlocked = m_wallet->m_wallet->is_transfer_unlocked(td);
|
ci->m_unlocked = m_wallet->m_wallet->is_transfer_unlocked(td);
|
||||||
ci->m_pubKey = string_tools::pod_to_hex(td.get_public_key());
|
ci->m_pubKey = string_tools::pod_to_hex(td.get_public_key());
|
||||||
ci->m_coinbase = td.m_tx.vin.size() == 1 && td.m_tx.vin[0].type() == typeid(cryptonote::txin_gen);
|
ci->m_coinbase = td.m_tx.vin.size() == 1 && td.m_tx.vin[0].type() == typeid(cryptonote::txin_gen);
|
||||||
|
ci->m_description = m_wallet->m_wallet->get_tx_note(td.m_txid);
|
||||||
|
|
||||||
m_rows.push_back(ci);
|
m_rows.push_back(ci);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,10 @@ namespace Monero {
|
|||||||
bool CoinsInfoImpl::coinbase() const {
|
bool CoinsInfoImpl::coinbase() const {
|
||||||
return m_coinbase;
|
return m_coinbase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string CoinsInfoImpl::description() const {
|
||||||
|
return m_description;
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
namespace Bitmonero = Monero;
|
||||||
|
@ -35,6 +35,7 @@ namespace Monero {
|
|||||||
virtual bool unlocked() const override;
|
virtual bool unlocked() const override;
|
||||||
virtual std::string pubKey() const override;
|
virtual std::string pubKey() const override;
|
||||||
virtual bool coinbase() const override;
|
virtual bool coinbase() const override;
|
||||||
|
virtual std::string description() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t m_blockHeight;
|
uint64_t m_blockHeight;
|
||||||
@ -57,6 +58,7 @@ namespace Monero {
|
|||||||
bool m_unlocked;
|
bool m_unlocked;
|
||||||
std::string m_pubKey;
|
std::string m_pubKey;
|
||||||
bool m_coinbase;
|
bool m_coinbase;
|
||||||
|
std::string m_description;
|
||||||
|
|
||||||
friend class CoinsImpl;
|
friend class CoinsImpl;
|
||||||
|
|
||||||
|
@ -1680,13 +1680,13 @@ PendingTransaction* WalletImpl::restoreMultisigTransaction(const string& signDat
|
|||||||
// - unconfirmed_transfer_details;
|
// - unconfirmed_transfer_details;
|
||||||
// - confirmed_transfer_details)
|
// - confirmed_transfer_details)
|
||||||
|
|
||||||
PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::set<std::string> &preferred_inputs)
|
||||||
|
|
||||||
{
|
{
|
||||||
clearStatus();
|
clearStatus();
|
||||||
// Pause refresh thread while creating transaction
|
// Pause refresh thread while creating transaction
|
||||||
pauseRefresh();
|
pauseRefresh();
|
||||||
|
|
||||||
cryptonote::address_parse_info info;
|
cryptonote::address_parse_info info;
|
||||||
|
|
||||||
uint32_t adjusted_priority = m_wallet->adjust_priority(static_cast<uint32_t>(priority));
|
uint32_t adjusted_priority = m_wallet->adjust_priority(static_cast<uint32_t>(priority));
|
||||||
@ -1746,6 +1746,19 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::vector<crypto::key_image> preferred_input_list;
|
||||||
|
if (!preferred_inputs.empty()) {
|
||||||
|
for (const auto &public_key : preferred_inputs) {
|
||||||
|
crypto::key_image keyImage;
|
||||||
|
bool r = epee::string_tools::hex_to_pod(public_key, keyImage);
|
||||||
|
if (!r) {
|
||||||
|
error = true;
|
||||||
|
setStatusError(tr("failed to parse key image"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
preferred_input_list.push_back(keyImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1760,11 +1773,11 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
|||||||
if (amount) {
|
if (amount) {
|
||||||
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
|
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
|
||||||
adjusted_priority,
|
adjusted_priority,
|
||||||
extra, subaddr_account, subaddr_indices);
|
extra, subaddr_account, subaddr_indices, preferred_input_list);
|
||||||
} else {
|
} else {
|
||||||
transaction->m_pending_tx = m_wallet->create_transactions_all(0, info.address, info.is_subaddress, 1, fake_outs_count, 0 /* unlock_time */,
|
transaction->m_pending_tx = m_wallet->create_transactions_all(0, info.address, info.is_subaddress, 1, fake_outs_count, 0 /* unlock_time */,
|
||||||
adjusted_priority,
|
adjusted_priority,
|
||||||
extra, subaddr_account, subaddr_indices);
|
extra, subaddr_account, subaddr_indices, preferred_input_list);
|
||||||
}
|
}
|
||||||
pendingTxPostProcess(transaction);
|
pendingTxPostProcess(transaction);
|
||||||
|
|
||||||
@ -1845,10 +1858,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const string &payment_id, optional<uint64_t> amount, uint32_t mixin_count,
|
PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const string &payment_id, optional<uint64_t> amount, uint32_t mixin_count,
|
||||||
PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::set<std::string> &preferred_inputs)
|
||||||
|
|
||||||
{
|
{
|
||||||
return createTransactionMultDest(std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, priority, subaddr_account, subaddr_indices);
|
return createTransactionMultDest(std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, priority, subaddr_account, subaddr_indices, preferred_inputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
PendingTransaction *WalletImpl::createTransactionSingle(const string &key_image, const string &dst_addr,
|
PendingTransaction *WalletImpl::createTransactionSingle(const string &key_image, const string &dst_addr,
|
||||||
|
@ -164,13 +164,14 @@ public:
|
|||||||
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
|
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
|
||||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
||||||
uint32_t subaddr_account = 0,
|
uint32_t subaddr_account = 0,
|
||||||
std::set<uint32_t> subaddr_indices = {}) override;
|
std::set<uint32_t> subaddr_indices = {},
|
||||||
|
const std::set<std::string> &preferred_inputs = {}) override;
|
||||||
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
||||||
optional<uint64_t> amount, uint32_t mixin_count,
|
optional<uint64_t> amount, uint32_t mixin_count,
|
||||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
||||||
uint32_t subaddr_account = 0,
|
uint32_t subaddr_account = 0,
|
||||||
std::set<uint32_t> subaddr_indices = {}) override;
|
std::set<uint32_t> subaddr_indices = {},
|
||||||
|
const std::set<std::string> &preferred_inputs = {}) override;
|
||||||
PendingTransaction * createTransactionSingle(const std::string &key_image, const std::string &dst_addr,
|
PendingTransaction * createTransactionSingle(const std::string &key_image, const std::string &dst_addr,
|
||||||
size_t outputs = 1, PendingTransaction::Priority priority = PendingTransaction::Priority_Low) override;
|
size_t outputs = 1, PendingTransaction::Priority priority = PendingTransaction::Priority_Low) override;
|
||||||
|
|
||||||
|
@ -342,6 +342,7 @@ struct CoinsInfo
|
|||||||
virtual bool unlocked() const = 0;
|
virtual bool unlocked() const = 0;
|
||||||
virtual std::string pubKey() const = 0;
|
virtual std::string pubKey() const = 0;
|
||||||
virtual bool coinbase() const = 0;
|
virtual bool coinbase() const = 0;
|
||||||
|
virtual std::string description() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Coins
|
struct Coins
|
||||||
@ -934,6 +935,7 @@ struct Wallet
|
|||||||
* \param subaddr_account subaddress account from which the input funds are taken
|
* \param subaddr_account subaddress account from which the input funds are taken
|
||||||
* \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices
|
* \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices
|
||||||
* \param priority
|
* \param priority
|
||||||
|
* \param preferred_inputs optional set of key_image strings from preferred inputs
|
||||||
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
|
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
|
||||||
* after object returned
|
* after object returned
|
||||||
*/
|
*/
|
||||||
@ -942,7 +944,7 @@ struct Wallet
|
|||||||
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
|
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
|
||||||
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
||||||
uint32_t subaddr_account = 0,
|
uint32_t subaddr_account = 0,
|
||||||
std::set<uint32_t> subaddr_indices = {}) = 0;
|
std::set<uint32_t> subaddr_indices = {}, const std::set<std::string> &preferred_inputs = {}) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored
|
* \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored
|
||||||
@ -953,6 +955,7 @@ struct Wallet
|
|||||||
* \param subaddr_account subaddress account from which the input funds are taken
|
* \param subaddr_account subaddress account from which the input funds are taken
|
||||||
* \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices
|
* \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices
|
||||||
* \param priority
|
* \param priority
|
||||||
|
* \param preferred_inputs optional set of key_image strings from preferred inputs
|
||||||
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
|
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
|
||||||
* after object returned
|
* after object returned
|
||||||
*/
|
*/
|
||||||
@ -961,7 +964,8 @@ struct Wallet
|
|||||||
optional<uint64_t> amount, uint32_t mixin_count,
|
optional<uint64_t> amount, uint32_t mixin_count,
|
||||||
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
||||||
uint32_t subaddr_account = 0,
|
uint32_t subaddr_account = 0,
|
||||||
std::set<uint32_t> subaddr_indices = {}) = 0;
|
std::set<uint32_t> subaddr_indices = {},
|
||||||
|
const std::set<std::string> &preferred_inputs = {}) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief createTransactionSingle creates transaction with single input
|
* \brief createTransactionSingle creates transaction with single input
|
||||||
|
@ -218,6 +218,17 @@ namespace
|
|||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_preferred_input(const std::vector<crypto::key_image>& preferred_input_list, const crypto::key_image& input) {
|
||||||
|
bool res = true;
|
||||||
|
if (preferred_input_list.size() > 0) {
|
||||||
|
auto it = std::find(preferred_input_list.begin(), preferred_input_list.end(), input);
|
||||||
|
if (it == preferred_input_list.end()) {
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
size_t get_num_outputs(const std::vector<cryptonote::tx_destination_entry> &dsts, const std::vector<tools::wallet2::transfer_details> &transfers, const std::vector<size_t> &selected_transfers)
|
size_t get_num_outputs(const std::vector<cryptonote::tx_destination_entry> &dsts, const std::vector<tools::wallet2::transfer_details> &transfers, const std::vector<size_t> &selected_transfers)
|
||||||
{
|
{
|
||||||
size_t outputs = dsts.size();
|
size_t outputs = dsts.size();
|
||||||
@ -10317,7 +10328,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
|
|||||||
LOG_PRINT_L2("transfer_selected_rct done");
|
LOG_PRINT_L2("transfer_selected_rct done");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices)
|
std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list)
|
||||||
{
|
{
|
||||||
std::vector<size_t> picks;
|
std::vector<size_t> picks;
|
||||||
float current_output_relatdness = 1.0f;
|
float current_output_relatdness = 1.0f;
|
||||||
@ -10328,6 +10339,10 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
|||||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||||
{
|
{
|
||||||
const transfer_details& td = m_transfers[i];
|
const transfer_details& td = m_transfers[i];
|
||||||
|
if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_spent(td, false) && !td.m_frozen && td.is_rct() && td.amount() >= needed_money && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1)
|
if (!is_spent(td, false) && !td.m_frozen && td.is_rct() && td.amount() >= needed_money && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1)
|
||||||
{
|
{
|
||||||
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
||||||
@ -10348,6 +10363,10 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
|||||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||||
{
|
{
|
||||||
const transfer_details& td = m_transfers[i];
|
const transfer_details& td = m_transfers[i];
|
||||||
|
if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_spent(td, false) && !td.m_frozen && !td.m_key_image_partial && td.is_rct() && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1)
|
if (!is_spent(td, false) && !td.m_frozen && !td.m_key_image_partial && td.is_rct() && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1)
|
||||||
{
|
{
|
||||||
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
||||||
@ -10359,6 +10378,10 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
|||||||
for (size_t j = i + 1; j < m_transfers.size(); ++j)
|
for (size_t j = i + 1; j < m_transfers.size(); ++j)
|
||||||
{
|
{
|
||||||
const transfer_details& td2 = m_transfers[j];
|
const transfer_details& td2 = m_transfers[j];
|
||||||
|
if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (td2.amount() > m_ignore_outputs_above || td2.amount() < m_ignore_outputs_below)
|
if (td2.amount() > m_ignore_outputs_above || td2.amount() < m_ignore_outputs_below)
|
||||||
{
|
{
|
||||||
MDEBUG("Ignoring output " << j << " of amount " << print_money(td2.amount()) << " which is outside prescribed range [" << print_money(m_ignore_outputs_below) << ", " << print_money(m_ignore_outputs_above) << "]");
|
MDEBUG("Ignoring output " << j << " of amount " << print_money(td2.amount()) << " which is outside prescribed range [" << print_money(m_ignore_outputs_below) << ", " << print_money(m_ignore_outputs_above) << "]");
|
||||||
@ -10931,7 +10954,7 @@ bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image,
|
|||||||
// This system allows for sending (almost) the entire balance, since it does
|
// This system allows for sending (almost) the entire balance, since it does
|
||||||
// not generate spurious change in all txes, thus decreasing the instantaneous
|
// not generate spurious change in all txes, thus decreasing the instantaneous
|
||||||
// usable balance.
|
// usable balance.
|
||||||
std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const unique_index_container& subtract_fee_from_outputs)
|
std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const unique_index_container& subtract_fee_from_outputs, const std::vector<crypto::key_image>& preferred_input_list)
|
||||||
{
|
{
|
||||||
//ensure device is let in NONE mode in any case
|
//ensure device is let in NONE mode in any case
|
||||||
hw::device &hwdev = m_account.get_device();
|
hw::device &hwdev = m_account.get_device();
|
||||||
@ -11139,6 +11162,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
|||||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||||
{
|
{
|
||||||
const transfer_details& td = m_transfers[i];
|
const transfer_details& td = m_transfers[i];
|
||||||
|
if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ignore_fractional_outputs && td.amount() < fractional_threshold)
|
if (m_ignore_fractional_outputs && td.amount() < fractional_threshold)
|
||||||
{
|
{
|
||||||
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below fractional threshold " << print_money(fractional_threshold));
|
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below fractional threshold " << print_money(fractional_threshold));
|
||||||
@ -11224,7 +11251,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
|||||||
// will get us a known fee.
|
// will get us a known fee.
|
||||||
uint64_t estimated_fee = estimate_fee(use_per_byte_fee, use_rct, 2, fake_outs_count, 2, extra.size(), bulletproof, clsag, bulletproof_plus, use_view_tags, base_fee, fee_quantization_mask);
|
uint64_t estimated_fee = estimate_fee(use_per_byte_fee, use_rct, 2, fake_outs_count, 2, extra.size(), bulletproof, clsag, bulletproof_plus, use_view_tags, base_fee, fee_quantization_mask);
|
||||||
total_needed_money = needed_money + (subtract_fee_from_outputs.size() ? 0 : estimated_fee);
|
total_needed_money = needed_money + (subtract_fee_from_outputs.size() ? 0 : estimated_fee);
|
||||||
preferred_inputs = pick_preferred_rct_inputs(total_needed_money, subaddr_account, subaddr_indices);
|
preferred_inputs = pick_preferred_rct_inputs(total_needed_money, subaddr_account, subaddr_indices, preferred_input_list);
|
||||||
if (!preferred_inputs.empty())
|
if (!preferred_inputs.empty())
|
||||||
{
|
{
|
||||||
string s;
|
string s;
|
||||||
@ -11260,7 +11287,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
|||||||
unsigned int original_output_index = 0, destination_index = 0;
|
unsigned int original_output_index = 0, destination_index = 0;
|
||||||
std::vector<size_t>* unused_transfers_indices = &unused_transfers_indices_per_subaddr[0].second;
|
std::vector<size_t>* unused_transfers_indices = &unused_transfers_indices_per_subaddr[0].second;
|
||||||
std::vector<size_t>* unused_dust_indices = &unused_dust_indices_per_subaddr[0].second;
|
std::vector<size_t>* unused_dust_indices = &unused_dust_indices_per_subaddr[0].second;
|
||||||
|
|
||||||
hwdev.set_mode(hw::device::TRANSACTION_CREATE_FAKE);
|
hwdev.set_mode(hw::device::TRANSACTION_CREATE_FAKE);
|
||||||
while ((!dsts.empty() && dsts[0].amount > 0) || adding_fee || !preferred_inputs.empty() || should_pick_a_second_output(use_rct, txes.back().selected_transfers.size(), *unused_transfers_indices, *unused_dust_indices)) {
|
while ((!dsts.empty() && dsts[0].amount > 0) || adding_fee || !preferred_inputs.empty() || should_pick_a_second_output(use_rct, txes.back().selected_transfers.size(), *unused_transfers_indices, *unused_dust_indices)) {
|
||||||
TX &tx = txes.back();
|
TX &tx = txes.back();
|
||||||
@ -11705,7 +11732,7 @@ bool wallet2::sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, c
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list)
|
||||||
{
|
{
|
||||||
std::vector<size_t> unused_transfers_indices;
|
std::vector<size_t> unused_transfers_indices;
|
||||||
std::vector<size_t> unused_dust_indices;
|
std::vector<size_t> unused_dust_indices;
|
||||||
@ -11734,6 +11761,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below
|
|||||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||||
{
|
{
|
||||||
const transfer_details& td = m_transfers[i];
|
const transfer_details& td = m_transfers[i];
|
||||||
|
if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ignore_fractional_outputs && td.amount() < fractional_threshold)
|
if (m_ignore_fractional_outputs && td.amount() < fractional_threshold)
|
||||||
{
|
{
|
||||||
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below threshold " << print_money(fractional_threshold));
|
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below threshold " << print_money(fractional_threshold));
|
||||||
|
@ -1114,8 +1114,8 @@ private:
|
|||||||
bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const;
|
bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const;
|
||||||
bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL);
|
bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL);
|
||||||
bool parse_tx_from_str(const std::string &signed_tx_st, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set &)> accept_func);
|
bool parse_tx_from_str(const std::string &signed_tx_st, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set &)> accept_func);
|
||||||
std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose
|
std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const unique_index_container& subtract_fee_from_outputs = {}, const std::vector<crypto::key_image>& preferred_input_list = {}); // pass subaddr_indices by value on purpose
|
||||||
std::vector<wallet2::pending_tx> create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices);
|
std::vector<wallet2::pending_tx> create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list = {});
|
||||||
std::vector<wallet2::pending_tx> create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
std::vector<wallet2::pending_tx> create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||||
std::vector<wallet2::pending_tx> create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
std::vector<wallet2::pending_tx> create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||||
bool sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, const std::vector<cryptonote::tx_destination_entry>& dsts, const unique_index_container& subtract_fee_from_outputs = {}) const;
|
bool sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, const std::vector<cryptonote::tx_destination_entry>& dsts, const unique_index_container& subtract_fee_from_outputs = {}) const;
|
||||||
@ -1799,7 +1799,7 @@ private:
|
|||||||
std::vector<uint64_t> get_unspent_amounts_vector(bool strict);
|
std::vector<uint64_t> get_unspent_amounts_vector(bool strict);
|
||||||
uint64_t get_dynamic_base_fee_estimate();
|
uint64_t get_dynamic_base_fee_estimate();
|
||||||
float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
|
float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
|
||||||
std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices);
|
std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list);
|
||||||
void set_spent(size_t idx, uint64_t height);
|
void set_spent(size_t idx, uint64_t height);
|
||||||
void set_unspent(size_t idx);
|
void set_unspent(size_t idx);
|
||||||
bool is_spent(const transfer_details &td, bool strict = true) const;
|
bool is_spent(const transfer_details &td, bool strict = true) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user