wallet::default_mixin exposed to public interface as

Wallet::setDefaultMixin, Wallet::defaultMixin;
wallet::create_transaction_2 used in Wallet::createTransaction
This commit is contained in:
Ilya Kitaev 2016-06-10 13:52:10 +03:00
parent a5374897f8
commit e7d8f2a085
4 changed files with 24 additions and 1 deletions

View file

@ -400,7 +400,7 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, uint64
try { try {
transaction->m_pending_tx = m_wallet->create_transactions(dsts, fake_outs_count, 0 /* unlock_time */, transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
0 /* unused fee arg*/, extra, m_trustedDaemon); 0 /* unused fee arg*/, extra, m_trustedDaemon);
} catch (const tools::error::daemon_busy&) { } catch (const tools::error::daemon_busy&) {
@ -486,6 +486,15 @@ void WalletImpl::setListener(WalletListener *l)
m_wallet2Callback->setListener(l); m_wallet2Callback->setListener(l);
} }
uint32_t WalletImpl::defaultMixin() const
{
return m_wallet->default_mixin();
}
void WalletImpl::setDefaultMixin(uint32_t arg)
{
m_wallet->default_mixin(arg);
}
bool WalletImpl::connectToDaemon() bool WalletImpl::connectToDaemon()

View file

@ -74,6 +74,8 @@ public:
virtual void disposeTransaction(PendingTransaction * t); virtual void disposeTransaction(PendingTransaction * t);
virtual TransactionHistory * history() const; virtual TransactionHistory * history() const;
virtual void setListener(WalletListener * l); virtual void setListener(WalletListener * l);
virtual uint32_t defaultMixin() const;
virtual void setDefaultMixin(uint32_t arg);
private: private:
void clearStatus(); void clearStatus();

View file

@ -167,6 +167,16 @@ struct Wallet
virtual void disposeTransaction(PendingTransaction * t) = 0; virtual void disposeTransaction(PendingTransaction * t) = 0;
virtual TransactionHistory * history() const = 0; virtual TransactionHistory * history() const = 0;
virtual void setListener(WalletListener *) = 0; virtual void setListener(WalletListener *) = 0;
/*!
* \brief defaultMixin - returns number of mixins used in transactions
* \return
*/
virtual uint32_t defaultMixin() const = 0;
/*!
* \brief setDefaultMixin - setum number of mixins to be used for new transactions
* \param arg
*/
virtual void setDefaultMixin(uint32_t arg) = 0;
}; };
/** /**

View file

@ -401,6 +401,8 @@ TEST_F(WalletTest1, WalletTransaction)
ASSERT_TRUE(wallet1->status() == Bitmonero::PendingTransaction::Status_Ok); ASSERT_TRUE(wallet1->status() == Bitmonero::PendingTransaction::Status_Ok);
std::string recepient_address = Utils::get_wallet_address(CURRENT_DST_WALLET, TESTNET_WALLET_PASS); std::string recepient_address = Utils::get_wallet_address(CURRENT_DST_WALLET, TESTNET_WALLET_PASS);
wallet1->setDefaultMixin(1);
ASSERT_TRUE(wallet1->defaultMixin() == 1);
Bitmonero::PendingTransaction * transaction = wallet1->createTransaction( Bitmonero::PendingTransaction * transaction = wallet1->createTransaction(
recepient_address, AMOUNT_10XMR); recepient_address, AMOUNT_10XMR);