message: Fix RPC spendzerocoin
diff: @@ -2878,8 +2878,8 @@ UniValue spendzerocoin(const UniValue& params, bool fHelp)
  "}\n"
  "\nExamples\n" +
  - HelpExampleCli("spendzerocoin", "5000 false true 100 \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"") +
  - HelpExampleRpc("spendzerocoin", "5000 false true 100 \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\""));
  + HelpExampleCli("spendzerocoin", "5000 false true \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"") +
  + HelpExampleRpc("spendzerocoin", "5000 false true \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\""));
  LOCK2(cs_main, pwalletMain->cs_wallet);
  @@ -2978,6 +2978,14 @@ UniValue spendzerocoinmints(const UniValue& params, bool fHelp)
  vMintsSelected.emplace_back(mint);
  nAmount += mint.GetDenominationAsAmount();
  +
  + CBitcoinAddress address = CBitcoinAddress(); // Optional sending address. Dummy initialization here.
  + if (params.size() == 4) {
  + // Destination address was supplied as params[4]. Optional parameters MUST be at the end
  + // to avoid type confusion from the JSON interpreter
  + address = CBitcoinAddress(params[3].get_str());
  + if(!address.IsValid())
  + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid PIVX address");
  }
  return DoZpivSpend(nAmount, false, true, 100, vMintsSelected, address_str);
  