Fix warnings surfaced by compiling with clang++.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
d306b72be4
commit
d3330ab797
|
@ -336,7 +336,6 @@ TEST(WalletZkeysTest, WriteViewingKeyDirectToDB) {
|
||||||
/**
|
/**
|
||||||
* This test covers methods on CWalletDB to load/save crypted z keys.
|
* This test covers methods on CWalletDB to load/save crypted z keys.
|
||||||
*/
|
*/
|
||||||
/* TODO: Uncomment during PR for #3388
|
|
||||||
TEST(WalletZkeysTest, WriteCryptedzkeyDirectToDb) {
|
TEST(WalletZkeysTest, WriteCryptedzkeyDirectToDb) {
|
||||||
|
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
SelectParams(CBaseChainParams::TESTNET);
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy",1.0, "") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy", 1*COIN, "") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "INVALID", recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "INVALID", recipients, {}, 1) );
|
||||||
} catch (const UniValue& objError) {
|
} catch (const UniValue& objError) {
|
||||||
BOOST_CHECK( find_error(objError, "Invalid from address"));
|
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.
|
// Testnet payment addresses begin with 'zt'. This test detects an incorrect prefix.
|
||||||
try {
|
try {
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy",1.0, "") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy", 1*COIN, "") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "zcMuhvq8sEkHALuSU2i4NbNQxshSAYrpCExec45ZjtivYPbuiFPwk6WHy4SvsbeZ4siy1WheuRGjtaJmoD1J8bFqNXhsG6U", recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "zcMuhvq8sEkHALuSU2i4NbNQxshSAYrpCExec45ZjtivYPbuiFPwk6WHy4SvsbeZ4siy1WheuRGjtaJmoD1J8bFqNXhsG6U", recipients, {}, 1) );
|
||||||
} catch (const UniValue& objError) {
|
} catch (const UniValue& objError) {
|
||||||
BOOST_CHECK( find_error(objError, "Invalid from address"));
|
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
|
// 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.
|
// invokes a method on pwalletMain, which is undefined in the google test environment.
|
||||||
try {
|
try {
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy",1.0, "") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy", 1*COIN, "") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "ztjiDe569DPNbyTE6TSdJTaSDhoXEHLGvYoUnBU1wfVNU52TEyT6berYtySkd21njAeEoh8fFJUT42kua9r8EnhBaEKqCpP", recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "ztjiDe569DPNbyTE6TSdJTaSDhoXEHLGvYoUnBU1wfVNU52TEyT6berYtySkd21njAeEoh8fFJUT42kua9r8EnhBaEKqCpP", recipients, {}, 1) );
|
||||||
} catch (const UniValue& objError) {
|
} catch (const UniValue& objError) {
|
||||||
BOOST_CHECK( find_error(objError, "no spending key found for zaddr"));
|
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
|
// there are no utxos to spend
|
||||||
{
|
{
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, taddr1, {}, recipients, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, taddr1, {}, recipients, 1) );
|
||||||
operation->main();
|
operation->main();
|
||||||
BOOST_CHECK(operation->isFailed());
|
BOOST_CHECK(operation->isFailed());
|
||||||
|
@ -1204,7 +1204,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||||
// minconf cannot be zero when sending from zaddr
|
// minconf cannot be zero when sending from zaddr
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::vector<SendManyRecipient> recipients = {SendManyRecipient(taddr1, 100.0, "DEADBEEF")};
|
std::vector<SendManyRecipient> recipients = {SendManyRecipient(taddr1, 100*COIN, "DEADBEEF")};
|
||||||
std::shared_ptr<AsyncRPCOperation> operation(new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 0));
|
std::shared_ptr<AsyncRPCOperation> operation(new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 0));
|
||||||
BOOST_CHECK(false); // Fail test if an exception is not thrown
|
BOOST_CHECK(false); // Fail test if an exception is not thrown
|
||||||
} catch (const UniValue& objError) {
|
} catch (const UniValue& objError) {
|
||||||
|
@ -1215,7 +1215,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||||
|
|
||||||
// there are no unspent notes to spend
|
// there are no unspent notes to spend
|
||||||
{
|
{
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(taddr1,100.0, "DEADBEEF") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient(taddr1, 100*COIN, "DEADBEEF") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
||||||
operation->main();
|
operation->main();
|
||||||
BOOST_CHECK(operation->isFailed());
|
BOOST_CHECK(operation->isFailed());
|
||||||
|
@ -1225,7 +1225,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||||
|
|
||||||
// get_memo_from_hex_string())
|
// get_memo_from_hex_string())
|
||||||
{
|
{
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
||||||
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
||||||
TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr);
|
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
|
// add_taddr_change_output_to_tx() will append a vout to a raw transaction
|
||||||
{
|
{
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
||||||
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
||||||
TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr);
|
TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr);
|
||||||
|
@ -1285,14 +1285,14 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||||
BOOST_CHECK(tx.vout.size() == 0);
|
BOOST_CHECK(tx.vout.size() == 0);
|
||||||
|
|
||||||
CReserveKey keyChange(pwalletMain);
|
CReserveKey keyChange(pwalletMain);
|
||||||
CAmount amount = AmountFromValue(ValueFromString("123.456"));
|
CAmount amount = 12345600000;
|
||||||
proxy.add_taddr_change_output_to_tx(keyChange, amount);
|
proxy.add_taddr_change_output_to_tx(keyChange, amount);
|
||||||
tx = proxy.getTx();
|
tx = proxy.getTx();
|
||||||
BOOST_CHECK(tx.vout.size() == 1);
|
BOOST_CHECK(tx.vout.size() == 1);
|
||||||
CTxOut out = tx.vout[0];
|
CTxOut out = tx.vout[0];
|
||||||
BOOST_CHECK_EQUAL(out.nValue, amount);
|
BOOST_CHECK_EQUAL(out.nValue, amount);
|
||||||
|
|
||||||
amount = AmountFromValue(ValueFromString("1.111"));
|
amount = 111100000;
|
||||||
proxy.add_taddr_change_output_to_tx(keyChange, amount);
|
proxy.add_taddr_change_output_to_tx(keyChange, amount);
|
||||||
tx = proxy.getTx();
|
tx = proxy.getTx();
|
||||||
BOOST_CHECK(tx.vout.size() == 2);
|
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
|
// add_taddr_outputs_to_tx() will append many vouts to a raw transaction
|
||||||
{
|
{
|
||||||
std::vector<SendManyRecipient> recipients = {
|
std::vector<SendManyRecipient> recipients = {
|
||||||
SendManyRecipient("tmTGScYwiLMzHe4uGZtBYmuqoW4iEoYNMXt",CAmount(1.23), ""),
|
SendManyRecipient("tmTGScYwiLMzHe4uGZtBYmuqoW4iEoYNMXt", 123000000, ""),
|
||||||
SendManyRecipient("tmUSbHz3vxnwLvRyNDXbwkZxjVyDodMJEhh",CAmount(4.56), ""),
|
SendManyRecipient("tmUSbHz3vxnwLvRyNDXbwkZxjVyDodMJEhh", 456000000, ""),
|
||||||
SendManyRecipient("tmYZAXYPCP56Xa5JQWWPZuK7o7bfUQW6kkd",CAmount(7.89), ""),
|
SendManyRecipient("tmYZAXYPCP56Xa5JQWWPZuK7o7bfUQW6kkd", 789000000, ""),
|
||||||
};
|
};
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
|
||||||
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
||||||
|
@ -1315,15 +1315,15 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||||
|
|
||||||
CTransaction tx = proxy.getTx();
|
CTransaction tx = proxy.getTx();
|
||||||
BOOST_CHECK(tx.vout.size() == 3);
|
BOOST_CHECK(tx.vout.size() == 3);
|
||||||
BOOST_CHECK_EQUAL(tx.vout[0].nValue, CAmount(1.23));
|
BOOST_CHECK_EQUAL(tx.vout[0].nValue, 123000000);
|
||||||
BOOST_CHECK_EQUAL(tx.vout[1].nValue, CAmount(4.56));
|
BOOST_CHECK_EQUAL(tx.vout[1].nValue, 456000000);
|
||||||
BOOST_CHECK_EQUAL(tx.vout[2].nValue, CAmount(7.89));
|
BOOST_CHECK_EQUAL(tx.vout[2].nValue, 789000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the perform_joinsplit methods.
|
// Test the perform_joinsplit methods.
|
||||||
{
|
{
|
||||||
// Dummy input so the operation object can be instantiated.
|
// Dummy input so the operation object can be instantiated.
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 0.0005, "ABCD") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 50000, "ABCD") };
|
||||||
|
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, {}, recipients, 1) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, {}, recipients, 1) );
|
||||||
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
||||||
|
@ -1425,7 +1425,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_taddr_to_sapling)
|
||||||
auto builder = TransactionBuilder(consensusParams, nextBlockHeight, pwalletMain);
|
auto builder = TransactionBuilder(consensusParams, nextBlockHeight, pwalletMain);
|
||||||
mtx = CreateNewContextualCMutableTransaction(consensusParams, nextBlockHeight);
|
mtx = CreateNewContextualCMutableTransaction(consensusParams, nextBlockHeight);
|
||||||
|
|
||||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 1 * COIN, "ABCD") };
|
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 1*COIN, "ABCD") };
|
||||||
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(builder, mtx, taddr1, {}, recipients, 0) );
|
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(builder, mtx, taddr1, {}, recipients, 0) );
|
||||||
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue