wallet2_api: implement estimateTransactionFee

This commit is contained in:
xiphon
2020-01-22 16:30:47 +00:00
parent 51873fec04
commit dab604e010
5 changed files with 45 additions and 14 deletions

View File

@@ -1671,6 +1671,26 @@ void WalletImpl::disposeTransaction(PendingTransaction *t)
delete t;
}
uint64_t WalletImpl::estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations,
PendingTransaction::Priority priority) const
{
const size_t pubkey_size = 33;
const size_t encrypted_paymentid_size = 11;
const size_t extra_size = pubkey_size + encrypted_paymentid_size;
return m_wallet->estimate_fee(
m_wallet->use_fork_rules(HF_VERSION_PER_BYTE_FEE, 0),
m_wallet->use_fork_rules(4, 0),
1,
m_wallet->get_min_ring_size() - 1,
destinations.size() + 1,
extra_size,
m_wallet->use_fork_rules(8, 0),
m_wallet->get_base_fee(),
m_wallet->get_fee_multiplier(m_wallet->adjust_priority(static_cast<uint32_t>(priority))),
m_wallet->get_fee_quantization_mask());
}
TransactionHistory *WalletImpl::history()
{
return m_history.get();