Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,075 Lines • ▼ Show 20 Lines | static UniValue settxfee(const Config &config, const JSONRPCRequest &request) { | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 1) { | request.params.size() > 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"settxfee amount\n" | "settxfee amount\n" | ||||
"\nSet the transaction fee per kB. Overwrites the paytxfee " | "\nSet the transaction fee per kB for this wallet. Overrides the " | ||||
"parameter.\n" | "global -paytxfee command line parameter.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. amount (numeric or string, required) The transaction " | "1. amount (numeric or string, required) The transaction " | ||||
"fee in " + | "fee in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
"/kB\n" | "/kB\n" | ||||
"\nResult\n" | "\nResult\n" | ||||
"true|false (boolean) Returns true if successful\n" | "true|false (boolean) Returns true if successful\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("settxfee", "0.00001") + | HelpExampleCli("settxfee", "0.00001") + | ||||
HelpExampleRpc("settxfee", "0.00001")); | HelpExampleRpc("settxfee", "0.00001")); | ||||
} | } | ||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
// Amount | |||||
Amount nAmount = AmountFromValue(request.params[0]); | Amount nAmount = AmountFromValue(request.params[0]); | ||||
payTxFee = CFeeRate(nAmount, 1000); | pwallet->m_pay_tx_fee = CFeeRate(nAmount, 1000); | ||||
return true; | return true; | ||||
} | } | ||||
static UniValue getwalletinfo(const Config &config, | static UniValue getwalletinfo(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | static UniValue getwalletinfo(const Config &config, | ||||
CKeyID masterKeyID = pwallet->GetHDChain().masterKeyID; | CKeyID masterKeyID = pwallet->GetHDChain().masterKeyID; | ||||
if (!masterKeyID.IsNull() && pwallet->CanSupportFeature(FEATURE_HD_SPLIT)) { | if (!masterKeyID.IsNull() && pwallet->CanSupportFeature(FEATURE_HD_SPLIT)) { | ||||
obj.pushKV("keypoolsize_hd_internal", | obj.pushKV("keypoolsize_hd_internal", | ||||
int64_t(pwallet->GetKeyPoolSize() - kpExternalSize)); | int64_t(pwallet->GetKeyPoolSize() - kpExternalSize)); | ||||
} | } | ||||
if (pwallet->IsCrypted()) { | if (pwallet->IsCrypted()) { | ||||
obj.pushKV("unlocked_until", pwallet->nRelockTime); | obj.pushKV("unlocked_until", pwallet->nRelockTime); | ||||
} | } | ||||
obj.pushKV("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())); | obj.pushKV("paytxfee", ValueFromAmount(pwallet->m_pay_tx_fee.GetFeePerK())); | ||||
if (!masterKeyID.IsNull()) { | if (!masterKeyID.IsNull()) { | ||||
obj.pushKV("hdmasterkeyid", masterKeyID.GetHex()); | obj.pushKV("hdmasterkeyid", masterKeyID.GetHex()); | ||||
} | } | ||||
return obj; | return obj; | ||||
} | } | ||||
static UniValue listwallets(const Config &config, | static UniValue listwallets(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
▲ Show 20 Lines • Show All 1,043 Lines • Show Last 20 Lines |