diff --git a/src/wallet/gtest/test_wallet_zkeys.cpp b/src/wallet/gtest/test_wallet_zkeys.cpp index fc205589a..619a61343 100644 --- a/src/wallet/gtest/test_wallet_zkeys.cpp +++ b/src/wallet/gtest/test_wallet_zkeys.cpp @@ -336,7 +336,6 @@ TEST(WalletZkeysTest, WriteViewingKeyDirectToDB) { /** * This test covers methods on CWalletDB to load/save crypted z keys. */ -/* TODO: Uncomment during PR for #3388 TEST(WalletZkeysTest, WriteCryptedzkeyDirectToDb) { SelectParams(CBaseChainParams::TESTNET); diff --git a/src/wallet/test/rpc_wallet_tests.cpp b/src/wallet/test/rpc_wallet_tests.cpp index 64f953412..5a3c86b66 100644 --- a/src/wallet/test/rpc_wallet_tests.cpp +++ b/src/wallet/test/rpc_wallet_tests.cpp @@ -1129,7 +1129,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters) } try { - std::vector recipients = { SendManyRecipient("dummy",1.0, "") }; + std::vector recipients = { SendManyRecipient("dummy", 1*COIN, "") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "INVALID", recipients, {}, 1) ); } catch (const UniValue& objError) { BOOST_CHECK( find_error(objError, "Invalid from address")); @@ -1137,7 +1137,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters) // Testnet payment addresses begin with 'zt'. This test detects an incorrect prefix. try { - std::vector recipients = { SendManyRecipient("dummy",1.0, "") }; + std::vector recipients = { SendManyRecipient("dummy", 1*COIN, "") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "zcMuhvq8sEkHALuSU2i4NbNQxshSAYrpCExec45ZjtivYPbuiFPwk6WHy4SvsbeZ4siy1WheuRGjtaJmoD1J8bFqNXhsG6U", recipients, {}, 1) ); } catch (const UniValue& objError) { BOOST_CHECK( find_error(objError, "Invalid from address")); @@ -1146,7 +1146,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters) // Note: The following will crash as a google test because AsyncRPCOperation_sendmany // invokes a method on pwalletMain, which is undefined in the google test environment. try { - std::vector recipients = { SendManyRecipient("dummy",1.0, "") }; + std::vector recipients = { SendManyRecipient("dummy", 1*COIN, "") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "ztjiDe569DPNbyTE6TSdJTaSDhoXEHLGvYoUnBU1wfVNU52TEyT6berYtySkd21njAeEoh8fFJUT42kua9r8EnhBaEKqCpP", recipients, {}, 1) ); } catch (const UniValue& objError) { BOOST_CHECK( find_error(objError, "no spending key found for zaddr")); @@ -1193,7 +1193,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // there are no utxos to spend { - std::vector recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") }; + std::vector recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, taddr1, {}, recipients, 1) ); operation->main(); BOOST_CHECK(operation->isFailed()); @@ -1204,7 +1204,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // minconf cannot be zero when sending from zaddr { try { - std::vector recipients = {SendManyRecipient(taddr1, 100.0, "DEADBEEF")}; + std::vector recipients = {SendManyRecipient(taddr1, 100*COIN, "DEADBEEF")}; std::shared_ptr operation(new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 0)); BOOST_CHECK(false); // Fail test if an exception is not thrown } catch (const UniValue& objError) { @@ -1215,7 +1215,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // there are no unspent notes to spend { - std::vector recipients = { SendManyRecipient(taddr1,100.0, "DEADBEEF") }; + std::vector recipients = { SendManyRecipient(taddr1, 100*COIN, "DEADBEEF") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) ); operation->main(); BOOST_CHECK(operation->isFailed()); @@ -1225,7 +1225,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // get_memo_from_hex_string()) { - std::vector recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") }; + std::vector recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) ); std::shared_ptr ptr = std::dynamic_pointer_cast (operation); TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr); @@ -1276,7 +1276,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // add_taddr_change_output_to_tx() will append a vout to a raw transaction { - std::vector recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") }; + std::vector recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) ); std::shared_ptr ptr = std::dynamic_pointer_cast (operation); TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr); @@ -1285,14 +1285,14 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) BOOST_CHECK(tx.vout.size() == 0); CReserveKey keyChange(pwalletMain); - CAmount amount = AmountFromValue(ValueFromString("123.456")); + CAmount amount = 12345600000; proxy.add_taddr_change_output_to_tx(keyChange, amount); tx = proxy.getTx(); BOOST_CHECK(tx.vout.size() == 1); CTxOut out = tx.vout[0]; BOOST_CHECK_EQUAL(out.nValue, amount); - amount = AmountFromValue(ValueFromString("1.111")); + amount = 111100000; proxy.add_taddr_change_output_to_tx(keyChange, amount); tx = proxy.getTx(); BOOST_CHECK(tx.vout.size() == 2); @@ -1303,9 +1303,9 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) // add_taddr_outputs_to_tx() will append many vouts to a raw transaction { std::vector recipients = { - SendManyRecipient("tmTGScYwiLMzHe4uGZtBYmuqoW4iEoYNMXt",CAmount(1.23), ""), - SendManyRecipient("tmUSbHz3vxnwLvRyNDXbwkZxjVyDodMJEhh",CAmount(4.56), ""), - SendManyRecipient("tmYZAXYPCP56Xa5JQWWPZuK7o7bfUQW6kkd",CAmount(7.89), ""), + SendManyRecipient("tmTGScYwiLMzHe4uGZtBYmuqoW4iEoYNMXt", 123000000, ""), + SendManyRecipient("tmUSbHz3vxnwLvRyNDXbwkZxjVyDodMJEhh", 456000000, ""), + SendManyRecipient("tmYZAXYPCP56Xa5JQWWPZuK7o7bfUQW6kkd", 789000000, ""), }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) ); std::shared_ptr ptr = std::dynamic_pointer_cast (operation); @@ -1315,15 +1315,15 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) CTransaction tx = proxy.getTx(); BOOST_CHECK(tx.vout.size() == 3); - BOOST_CHECK_EQUAL(tx.vout[0].nValue, CAmount(1.23)); - BOOST_CHECK_EQUAL(tx.vout[1].nValue, CAmount(4.56)); - BOOST_CHECK_EQUAL(tx.vout[2].nValue, CAmount(7.89)); + BOOST_CHECK_EQUAL(tx.vout[0].nValue, 123000000); + BOOST_CHECK_EQUAL(tx.vout[1].nValue, 456000000); + BOOST_CHECK_EQUAL(tx.vout[2].nValue, 789000000); } // Test the perform_joinsplit methods. { // Dummy input so the operation object can be instantiated. - std::vector recipients = { SendManyRecipient(zaddr1, 0.0005, "ABCD") }; + std::vector recipients = { SendManyRecipient(zaddr1, 50000, "ABCD") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, {}, recipients, 1) ); std::shared_ptr ptr = std::dynamic_pointer_cast (operation); @@ -1425,7 +1425,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_taddr_to_sapling) auto builder = TransactionBuilder(consensusParams, nextBlockHeight, pwalletMain); mtx = CreateNewContextualCMutableTransaction(consensusParams, nextBlockHeight); - std::vector recipients = { SendManyRecipient(zaddr1, 1 * COIN, "ABCD") }; + std::vector recipients = { SendManyRecipient(zaddr1, 1*COIN, "ABCD") }; std::shared_ptr operation( new AsyncRPCOperation_sendmany(builder, mtx, taddr1, {}, recipients, 0) ); std::shared_ptr ptr = std::dynamic_pointer_cast (operation);