diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index 084d99c80..7e0477eb7 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -80,10 +80,10 @@ static int AppInitRawTx(int argc, char* argv[]) if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help")) { // First part of help message is specific to this utility - std::string strUsage = _("Zcash zcash-tx utility version") + " " + FormatFullVersion() + "\n\n" + + std::string strUsage = _("Hush komodo-tx utility version") + " " + FormatFullVersion() + "\n\n" + _("Usage:") + "\n" + - " zcash-tx [options] [commands] " + _("Update hex-encoded zcash transaction") + "\n" + - " zcash-tx [options] -create [commands] " + _("Create hex-encoded zcash transaction") + "\n" + + " komodo-tx [options] [commands] " + _("Update hex-encoded zcash transaction") + "\n" + + " komodo-tx [options] -create [commands] " + _("Create hex-encoded zcash transaction") + "\n" + "\n"; fprintf(stdout, "%s", strUsage.c_str()); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index fe7ac2313..9f21e3455 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -343,7 +343,7 @@ UniValue setaccount(const UniValue& params, bool fHelp) CTxDestination dest = DecodeDestination(params[0].get_str()); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!"); } string strAccount; @@ -390,7 +390,7 @@ UniValue getaccount(const UniValue& params, bool fHelp) CTxDestination dest = DecodeDestination(params[0].get_str()); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!"); } std::string strAccount; @@ -450,7 +450,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr if (nValue > curBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds"); - // Parse Zcash address + // Parse Hush address CScript scriptPubKey = GetScriptForDestination(address); // Create and send the transaction @@ -524,7 +524,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp) CTxDestination dest = DecodeDestination(params[0].get_str()); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!"); } // Amount @@ -936,7 +936,7 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp) // Bitcoin address CTxDestination dest = DecodeDestination(params[0].get_str()); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!"); } CScript scriptPubKey = GetScriptForDestination(dest); if (!IsMine(*pwalletMain, scriptPubKey)) { @@ -1390,7 +1390,7 @@ UniValue sendfrom(const UniValue& params, bool fHelp) std::string strAccount = AccountFromValue(params[0]); CTxDestination dest = DecodeDestination(params[1].get_str()); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Zcash address"); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Hush address!"); } CAmount nAmount = AmountFromValue(params[2]); if (nAmount <= 0) @@ -1487,7 +1487,7 @@ UniValue sendmany(const UniValue& params, bool fHelp) for (const std::string& name_ : keys) { CTxDestination dest = DecodeDestination(name_); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Zcash address: ") + name_); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Hush address: ") + name_); } CScript scriptPubKey = GetScriptForDestination(dest); @@ -2860,7 +2860,7 @@ UniValue listunspent(const UniValue& params, bool fHelp) " \"txid\" : \"txid\", (string) the transaction id \n" " \"vout\" : n, (numeric) the vout value\n" " \"generated\" : true|false (boolean) true if txout is a coinbase transaction output\n" - " \"address\" : \"address\", (string) the Zcash address\n" + " \"address\" : \"address\", (string) the Hush address\n" " \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n" " \"scriptPubKey\" : \"key\", (string) the script key\n" " \"amount\" : x.xxx, (numeric) the transaction amount in " + CURRENCY_UNIT + "\n" @@ -2894,7 +2894,7 @@ UniValue listunspent(const UniValue& params, bool fHelp) const UniValue& input = inputs[idx]; CTxDestination dest = DecodeDestination(input.get_str()); if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Zcash address: ") + input.get_str()); + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Hush address: ") + input.get_str()); } if (!destinations.insert(dest).second) { throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ") + input.get_str()); @@ -3018,13 +3018,12 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) "Optionally filter to only include notes sent to specified addresses.\n" "When minconf is 0, unspent notes with zero confirmations are returned, even though they are not immediately spendable.\n" "Results are an array of Objects, each of which has:\n" - "{txid, jsindex, jsoutindex, confirmations, address, amount, memo} (Sprout)\n" "{txid, outindex, confirmations, address, amount, memo} (Sapling)\n" "\nArguments:\n" "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n" "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n" "3. includeWatchonly (bool, optional, default=false) Also include watchonly addresses (see 'z_importviewingkey')\n" - "4. \"addresses\" (string) A json array of zaddrs (both Sprout and Sapling) to filter on. Duplicate addresses not allowed.\n" + "4. \"addresses\" (string) A json array of zaddrs to filter on. Duplicate addresses not allowed.\n" " [\n" " \"address\" (string) zaddr\n" " ,...\n" @@ -3131,32 +3130,6 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, true, !fIncludeWatchonly, false); std::set> nullifierSet = pwalletMain->GetNullifiersForAddresses(zaddrs); - for (auto & entry : sproutEntries) { - UniValue obj(UniValue::VOBJ); - - int nHeight = tx_height(entry.jsop.hash); - int dpowconfs = komodo_dpowconfs(nHeight, entry.confirmations); - // Only return notarized results when minconf>1 - if (nMinDepth > 1 && dpowconfs == 1) - continue; - - obj.push_back(Pair("txid", entry.jsop.hash.ToString())); - obj.push_back(Pair("jsindex", (int)entry.jsop.js )); - obj.push_back(Pair("jsoutindex", (int)entry.jsop.n)); - obj.push_back(Pair("confirmations", dpowconfs)); - obj.push_back(Pair("rawconfirmations", entry.confirmations)); - bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get(entry.address)); - obj.push_back(Pair("spendable", hasSproutSpendingKey)); - obj.push_back(Pair("address", EncodePaymentAddress(entry.address))); - obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value())))); - std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end()); - obj.push_back(Pair("memo", HexStr(data))); - if (hasSproutSpendingKey) { - obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop))); - } - results.push_back(obj); - } - for (auto & entry : saplingEntries) { UniValue obj(UniValue::VOBJ); @@ -4150,9 +4123,9 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp) " ],\n" " \"outputs\" : [\n" " {\n" - " \"type\" : \"sprout|sapling\", (string) The type of address\n" + " \"type\" : \"sapling\", (string) The type of address\n" " \"output\" : n, (numeric) the index of the output within the vShieldedOutput\n" - " \"address\" : \"zcashaddress\", (string) The Zcash address involved in the transaction\n" + " \"address\" : \"hushaddress\", (string) The Hush address involved in the transaction\n" " \"recovered\" : true|false (boolean) True if the output is not for an address in the wallet\n" " \"value\" : x.xxx (numeric) The amount in " + CURRENCY_UNIT + "\n" " \"valueZat\" : xxxx (numeric) The amount in zatoshis\n" diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1ae73e190..7006dd0d0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2487,45 +2487,6 @@ void CWalletTx::SetSaplingNoteData(mapSaplingNoteData_t ¬eData) } } -std::pair CWalletTx::DecryptSproutNote( - JSOutPoint jsop) const -{ - LOCK(pwallet->cs_wallet); - - auto nd = this->mapSproutNoteData.at(jsop); - SproutPaymentAddress pa = nd.address; - - // Get cached decryptor - ZCNoteDecryption decryptor; - if (!pwallet->GetNoteDecryptor(pa, decryptor)) { - // Note decryptors are created when the wallet is loaded, so it should always exist - throw std::runtime_error(strprintf( - "Could not find note decryptor for payment address %s", - EncodePaymentAddress(pa))); - } - - auto hSig = this->vjoinsplit[jsop.js].h_sig(*pzcashParams, this->joinSplitPubKey); - try { - SproutNotePlaintext plaintext = SproutNotePlaintext::decrypt( - decryptor, - this->vjoinsplit[jsop.js].ciphertexts[jsop.n], - this->vjoinsplit[jsop.js].ephemeralKey, - hSig, - (unsigned char) jsop.n); - - return std::make_pair(plaintext, pa); - } catch (const note_decryption_failed &err) { - // Couldn't decrypt with this spending key - throw std::runtime_error(strprintf( - "Could not decrypt note for payment address %s", - EncodePaymentAddress(pa))); - } catch (const std::exception &exc) { - // Unexpected failure - throw std::runtime_error(strprintf( - "Error while decrypting note for payment address %s: %s", - EncodePaymentAddress(pa), exc.what())); - } -} boost::optional