wallet: automatically use low priority if safe (no backlog & recent blocks not full)

This commit is contained in:
stoffu 2018-01-15 12:05:16 +09:00
parent c903df5ece
commit 30c44bce06
No known key found for this signature in database
GPG key ID: 41DAB8343A9EC012
7 changed files with 136 additions and 18 deletions

View file

@ -1074,6 +1074,8 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
if (fake_outs_count == 0)
fake_outs_count = DEFAULT_MIXIN;
uint32_t adjusted_priority = m_wallet->adjust_priority(static_cast<uint32_t>(priority));
PendingTransactionImpl * transaction = new PendingTransactionImpl(*this);
do {
@ -1133,7 +1135,7 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
de.is_subaddress = info.is_subaddress;
dsts.push_back(de);
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
static_cast<uint32_t>(priority),
adjusted_priority,
extra, subaddr_account, subaddr_indices, m_trustedDaemon);
} else {
// for the GUI, sweep_all (i.e. amount set as "(all)") will always sweep all the funds in all the addresses
@ -1143,7 +1145,7 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
subaddr_indices.insert(index);
}
transaction->m_pending_tx = m_wallet->create_transactions_all(0, info.address, info.is_subaddress, fake_outs_count, 0 /* unlock_time */,
static_cast<uint32_t>(priority),
adjusted_priority,
extra, subaddr_account, subaddr_indices, m_trustedDaemon);
}

View file

@ -70,6 +70,7 @@ struct PendingTransaction
};
enum Priority {
Priority_Default = 0,
Priority_Low = 1,
Priority_Medium = 2,
Priority_High = 3,