aboutsummaryrefslogtreecommitdiff
path: root/tests/libwallet_api_tests
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-06-20 22:56:30 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-06-23 16:01:41 +0300
commit2efec04f74b8767d86b4b85aac1b6ec1fdc7e1b3 (patch)
tree47257b65d9283d988d893811ec596b76aa203192 /tests/libwallet_api_tests
parentdouble/string to monero integer convertion methods (diff)
downloadmonero-2efec04f74b8767d86b4b85aac1b6ec1fdc7e1b3.tar.xz
Wallet::createTransaction: added mixin_count param
Diffstat (limited to 'tests/libwallet_api_tests')
-rw-r--r--tests/libwallet_api_tests/main.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp
index 849d76e1b..ddd6969c6 100644
--- a/tests/libwallet_api_tests/main.cpp
+++ b/tests/libwallet_api_tests/main.cpp
@@ -428,6 +428,45 @@ TEST_F(WalletTest1, WalletTransaction)
ASSERT_TRUE(wmgr->closeWallet(wallet1));
}
*/
+
+TEST_F(WalletTest1, WalletTransactionWithMixin)
+{
+
+ std::vector<int> mixins;
+ // 2,3,4,5,6,7,8,9,10,15,20,25 can we do it like that?
+ mixins.push_back(2); mixins.push_back(3); mixins.push_back(4); mixins.push_back(5); mixins.push_back(6);
+ mixins.push_back(7); mixins.push_back(8); mixins.push_back(9); mixins.push_back(10); mixins.push_back(15);
+ mixins.push_back(20); mixins.push_back(25);
+
+
+ Bitmonero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true);
+
+
+ // make sure testnet daemon is running
+ ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0));
+ ASSERT_TRUE(wallet1->refresh());
+ uint64_t balance = wallet1->balance();
+ ASSERT_TRUE(wallet1->status() == Bitmonero::PendingTransaction::Status_Ok);
+
+ std::string recepient_address = Utils::get_wallet_address(CURRENT_DST_WALLET, TESTNET_WALLET_PASS);
+ for (auto mixin : mixins) {
+ std::cerr << "Transaction mixin count: " << mixin << std::endl;
+ Bitmonero::PendingTransaction * transaction = wallet1->createTransaction(
+ recepient_address, AMOUNT_5XMR, mixin);
+
+ std::cerr << "Transaction status: " << transaction->status() << std::endl;
+ std::cerr << "Transaction fee: " << Bitmonero::Wallet::displayAmount(transaction->fee()) << std::endl;
+ std::cerr << "Transaction error: " << transaction->errorString() << std::endl;
+ ASSERT_TRUE(transaction->status() == Bitmonero::PendingTransaction::Status_Ok);
+ wallet1->disposeTransaction(transaction);
+ }
+
+ wallet1->refresh();
+
+ ASSERT_TRUE(wallet1->balance() == balance);
+ ASSERT_TRUE(wmgr->closeWallet(wallet1));
+}
+
TEST_F(WalletTest1, WalletHistory)
{
Bitmonero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true);
@@ -465,7 +504,7 @@ TEST_F(WalletTest1, WalletTransactionAndHistory)
std::string wallet4_addr = Utils::get_wallet_address(CURRENT_DST_WALLET, TESTNET_WALLET_PASS);
- Bitmonero::PendingTransaction * tx = wallet_src->createTransaction(wallet4_addr, AMOUNT_10XMR * 5);
+ Bitmonero::PendingTransaction * tx = wallet_src->createTransaction(wallet4_addr, AMOUNT_10XMR * 5, 0);
ASSERT_TRUE(tx->status() == Bitmonero::PendingTransaction::Status_Ok);
ASSERT_TRUE(tx->commit());
history = wallet_src->history();