From f20be2cff7a67e79ddfab19c7ad4c68606255522 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 9 Oct 2018 23:22:53 +0100 Subject: [PATCH] Rename nOrchardAnchorConfirmations -> nAnchorConfirmations --- src/wallet/rpcwallet.cpp | 12 +++++------- src/wallet/wallet.cpp | 10 +++++----- src/wallet/wallet.h | 8 ++++---- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index fc7e1a67a..5815f15c7 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4858,7 +4858,6 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() < 2 || params.size() > 5) throw runtime_error( - strprintf( "z_sendmany \"fromaddress\" [{\"address\":... ,\"amount\":...},...] ( minconf ) ( fee ) ( privacyPolicy )\n" "\nSend multiple times. Amounts are decimal numbers with at most 8 digits of precision." "\nChange generated from one or more transparent addresses flows to a new transparent" @@ -4879,7 +4878,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) " \"amount\":amount (numeric, required) The numeric amount in " + CURRENCY_UNIT + " is the value\n" " \"memo\":memo (string, optional) If the address is a zaddr, raw data represented in hexadecimal string format\n" " }, ... ]\n" - "3. minconf (numeric, optional, default=%u) Only use funds confirmed at least this many times.\n" + "3. minconf (numeric, optional, default=" + strprintf("%u", nAnchorConfirmations) + ") Only use funds confirmed at least this many times.\n" "4. fee (numeric, optional, default=" + strprintf("%s", FormatMoney(DEFAULT_FEE)) + ") The fee amount to attach to this transaction.\n" "5. privacyPolicy (string, optional, default=\"LegacyCompat\") Policy for what information leakage is acceptable.\n" " One of the following strings:\n" @@ -4907,7 +4906,6 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) + HelpExampleCli("z_sendmany", "\"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" '[{\"address\": \"ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf\", \"amount\": 5.0}]'") + HelpExampleCli("z_sendmany", "\"ANY_TADDR\" '[{\"address\": \"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", \"amount\": 2.0}]'") + HelpExampleRpc("z_sendmany", "\"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", [{\"address\": \"ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf\", \"amount\": 5.0}]") - , nOrchardAnchorConfirmations) ); LOCK2(cs_main, pwalletMain->cs_wallet); @@ -5092,7 +5090,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) } // Minimum confirmations - int nMinDepth = nOrchardAnchorConfirmations; + int nMinDepth = nAnchorConfirmations; if (params.size() > 2) { nMinDepth = params[2].get_int(); } @@ -5141,7 +5139,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) // Allow Orchard recipients by setting an Orchard anchor. // TODO: Add an orchardAnchorHeight field to ZTXOSelector so we can ensure the // same anchor is used for witnesses of any selected Orchard note. - auto orchardAnchorHeight = nextBlockHeight - std::min((unsigned int) nMinDepth, nOrchardAnchorConfirmations); + auto orchardAnchorHeight = nextBlockHeight - std::min((unsigned int) nMinDepth, nAnchorConfirmations); orchardAnchor = chainActive[orchardAnchorHeight]->hashFinalOrchardRoot; } TransactionBuilder builder(chainparams.GetConsensus(), nextBlockHeight, orchardAnchor, pwalletMain); @@ -5498,7 +5496,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp) std::optional orchardAnchor; if (canopyActive) { // Allow Orchard recipients by setting an Orchard anchor. - auto orchardAnchorHeight = nextBlockHeight - nOrchardAnchorConfirmations; + auto orchardAnchorHeight = nextBlockHeight - nAnchorConfirmations; orchardAnchor = chainActive[orchardAnchorHeight]->hashFinalOrchardRoot; } TransactionBuilder builder = TransactionBuilder( @@ -5975,7 +5973,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) // Allow Orchard recipients by setting an Orchard anchor. // TODO: Add an orchardAnchorHeight field to ZTXOSelector so we can ensure the // same anchor is used for witnesses of any selected Orchard note. - auto orchardAnchorHeight = nextBlockHeight - nOrchardAnchorConfirmations; + auto orchardAnchorHeight = nextBlockHeight - nAnchorConfirmations; orchardAnchor = chainActive[orchardAnchorHeight]->hashFinalOrchardRoot; } builder = TransactionBuilder(Params().GetConsensus(), nextBlockHeight, orchardAnchor, pwalletMain); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c7cbb1100..48dc4ec55 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -51,7 +51,7 @@ unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE; bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS; bool fPayAtLeastCustomFee = true; -unsigned int nOrchardAnchorConfirmations = DEFAULT_ORCHARD_ANCHOR_CONFIRMATIONS; +unsigned int nAnchorConfirmations = DEFAULT_ANCHOR_CONFIRMATIONS; const char * DEFAULT_WALLET_DAT = "wallet.dat"; @@ -6575,12 +6575,12 @@ bool CWallet::ParameterInteraction(const CChainParams& params) return UIError(_("-migrationdestaddress must be a valid Sapling address.")); } } - if (mapArgs.count("-orchardanchorconfirmations")) { - int64_t confirmations = atoi64(mapArgs["-orchardanchorconfirmations"]); + if (mapArgs.count("-anchorconfirmations")) { + int64_t confirmations = atoi64(mapArgs["-anchorconfirmations"]); if (confirmations < 1) { - return UIError(strprintf(_("Invalid value for -orchardanchorconfirmations='%u' (must be least 1)"), confirmations)); + return UIError(strprintf(_("Invalid value for -anchorconfirmations='%u' (must be least 1)"), confirmations)); } - nOrchardAnchorConfirmations = confirmations; + nAnchorConfirmations = confirmations; } return true; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 05c578707..e1a838a16 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -53,7 +53,7 @@ extern unsigned int nTxConfirmTarget; extern bool bSpendZeroConfChange; extern bool fSendFreeTransactions; extern bool fPayAtLeastCustomFee; -extern unsigned int nOrchardAnchorConfirmations; +extern unsigned int nAnchorConfirmations; static const unsigned int DEFAULT_KEYPOOL_SIZE = 100; //! -paytxfee default @@ -78,8 +78,8 @@ static const unsigned int WITNESS_CACHE_SIZE = MAX_REORG_LENGTH + 1; //! Amount of entropy used in generation of the mnemonic seed, in bytes. static const size_t WALLET_MNEMONIC_ENTROPY_LENGTH = 32; -//! -orchardanchorconfirmations default -static const unsigned int DEFAULT_ORCHARD_ANCHOR_CONFIRMATIONS = 10; +//! -anchorconfirmations default +static const unsigned int DEFAULT_ANCHOR_CONFIRMATIONS = 10; extern const char * DEFAULT_WALLET_DAT; @@ -1967,7 +1967,7 @@ public: std::vector& saplingEntriesRet, std::vector& orchardNotesRet, const std::optional& noteFilter, - int minDepth=1, + int minDepth, int maxDepth=INT_MAX, bool ignoreSpent=true, bool requireSpendingKey=true,