Auto merge of #2525 - bitcartel:2519_no_zero_minconf_from_zaddr_zsendmany, r=daira
When sending from a zaddr, minconf cannot be zero. Closes #2519.
This commit is contained in:
@@ -975,7 +975,19 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
|
||||
std::string msg = operation->getErrorMessage();
|
||||
BOOST_CHECK( msg.find("Insufficient funds, no UTXOs found") != string::npos);
|
||||
}
|
||||
|
||||
// minconf cannot be zero when sending from zaddr
|
||||
{
|
||||
try {
|
||||
std::vector<SendManyRecipient> recipients = {SendManyRecipient(taddr1, 100.0, "DEADBEEF")};
|
||||
std::shared_ptr<AsyncRPCOperation> operation(new AsyncRPCOperation_sendmany(zaddr1, recipients, {}, 0));
|
||||
BOOST_CHECK(false); // Fail test if an exception is not thrown
|
||||
} catch (const UniValue& objError) {
|
||||
BOOST_CHECK(find_error(objError, "Minconf cannot be zero when sending from zaddr"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// there are no unspent notes to spend
|
||||
{
|
||||
std::vector<SendManyRecipient> recipients = { SendManyRecipient(taddr1,100.0, "DEADBEEF") };
|
||||
|
||||
@@ -93,6 +93,10 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
|
||||
}
|
||||
}
|
||||
|
||||
if (isfromzaddr_ && minDepth==0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Minconf cannot be zero when sending from zaddr");
|
||||
}
|
||||
|
||||
// Log the context info i.e. the call parameters to z_sendmany
|
||||
if (LogAcceptCategory("zrpcunsafe")) {
|
||||
LogPrint("zrpcunsafe", "%s: z_sendmany initialized (params=%s)\n", getId(), contextInfo.write());
|
||||
|
||||
Reference in New Issue
Block a user