Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
rpcwallet.cpp File Reference
#include "base58.h"
#include "rpcserver.h"
#include "init.h"
#include "net.h"
#include "netbase.h"
#include "util.h"
#include "wallet.h"
#include "walletdb.h"
#include <stdint.h>
#include <boost/assign/list_of.hpp>
#include "json/json_spirit_utils.h"
#include "json/json_spirit_value.h"
+ Include dependency graph for rpcwallet.cpp:

Go to the source code of this file.

Classes

struct  tallyitem
 

Functions

std::string HelpRequiringPassphrase ()
 
void EnsureWalletIsUnlocked ()
 
void WalletTxToJSON (const CWalletTx &wtx, Object &entry)
 
string AccountFromValue (const Value &value)
 
Value getnewaddress (const Array &params, bool fHelp)
 
CBitcoinAddress GetAccountAddress (string strAccount, bool bForceNew=false)
 
Value getaccountaddress (const Array &params, bool fHelp)
 
Value getrawchangeaddress (const Array &params, bool fHelp)
 
Value setaccount (const Array &params, bool fHelp)
 
Value getaccount (const Array &params, bool fHelp)
 
Value getaddressesbyaccount (const Array &params, bool fHelp)
 
Value sendtoaddress (const Array &params, bool fHelp)
 
Value listaddressgroupings (const Array &params, bool fHelp)
 
Value signmessage (const Array &params, bool fHelp)
 
Value getreceivedbyaddress (const Array &params, bool fHelp)
 
Value getreceivedbyaccount (const Array &params, bool fHelp)
 
int64_t GetAccountBalance (CWalletDB &walletdb, const string &strAccount, int nMinDepth)
 
int64_t GetAccountBalance (const string &strAccount, int nMinDepth)
 
Value getbalance (const Array &params, bool fHelp)
 
Value getunconfirmedbalance (const Array &params, bool fHelp)
 
Value movecmd (const Array &params, bool fHelp)
 
Value sendfrom (const Array &params, bool fHelp)
 
Value sendmany (const Array &params, bool fHelp)
 
CScript _createmultisig_redeemScript (const Array &params)
 
Value addmultisigaddress (const Array &params, bool fHelp)
 
Value ListReceived (const Array &params, bool fByAccounts)
 
Value listreceivedbyaddress (const Array &params, bool fHelp)
 
Value listreceivedbyaccount (const Array &params, bool fHelp)
 
static void MaybePushAddress (Object &entry, const CTxDestination &dest)
 
void ListTransactions (const CWalletTx &wtx, const string &strAccount, int nMinDepth, bool fLong, Array &ret)
 
void AcentryToJSON (const CAccountingEntry &acentry, const string &strAccount, Array &ret)
 
Value listtransactions (const Array &params, bool fHelp)
 
Value listaccounts (const Array &params, bool fHelp)
 
Value listsinceblock (const Array &params, bool fHelp)
 
Value gettransaction (const Array &params, bool fHelp)
 
Value backupwallet (const Array &params, bool fHelp)
 
Value keypoolrefill (const Array &params, bool fHelp)
 
static void LockWallet (CWallet *pWallet)
 
Value walletpassphrase (const Array &params, bool fHelp)
 
Value walletpassphrasechange (const Array &params, bool fHelp)
 
Value walletlock (const Array &params, bool fHelp)
 
Value encryptwallet (const Array &params, bool fHelp)
 
Value lockunspent (const Array &params, bool fHelp)
 
Value listlockunspent (const Array &params, bool fHelp)
 
Value settxfee (const Array &params, bool fHelp)
 
Value getwalletinfo (const Array &params, bool fHelp)
 

Variables

int64_t nWalletUnlockTime
 
static CCriticalSection cs_nWalletUnlockTime
 

Function Documentation

CScript _createmultisig_redeemScript ( const Array &  params)

Definition at line 179 of file rpcmisc.cpp.

References CBitcoinAddress::GetKeyID(), CCryptoKeyStore::GetPubKey(), CPubKey::IsFullyValid(), IsHex(), CBitcoinAddress::IsValid(), MAX_SCRIPT_ELEMENT_SIZE, ParseHex(), pwalletMain, CScript::SetMultisig(), and strprintf.

Referenced by addmultisigaddress(), and createmultisig().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string AccountFromValue ( const Value &  value)

Definition at line 66 of file rpcwallet.cpp.

References JSONRPCError(), and RPC_WALLET_INVALID_ACCOUNT_NAME.

Referenced by addmultisigaddress(), getaccountaddress(), getaddressesbyaccount(), getbalance(), getnewaddress(), getreceivedbyaccount(), movecmd(), sendfrom(), sendmany(), and setaccount().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AcentryToJSON ( const CAccountingEntry acentry,
const string &  strAccount,
Array &  ret 
)

Definition at line 1161 of file rpcwallet.cpp.

References CAccountingEntry::nCreditDebit, CAccountingEntry::nTime, CAccountingEntry::strAccount, CAccountingEntry::strComment, CAccountingEntry::strOtherAccount, and ValueFromAmount().

Referenced by listtransactions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value addmultisigaddress ( const Array &  params,
bool  fHelp 
)

Definition at line 876 of file rpcwallet.cpp.

References _createmultisig_redeemScript(), AccountFromValue(), CWallet::AddCScript(), CScript::GetID(), HelpExampleCli(), HelpExampleRpc(), pwalletMain, CWallet::SetAddressBook(), and CBase58Data::ToString().

+ Here is the call graph for this function:

Value backupwallet ( const Array &  params,
bool  fHelp 
)

Definition at line 1501 of file rpcwallet.cpp.

References BackupWallet(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), pwalletMain, and RPC_WALLET_ERROR.

+ Here is the call graph for this function:

Value encryptwallet ( const Array &  params,
bool  fHelp 
)

Definition at line 1691 of file rpcwallet.cpp.

References CWallet::EncryptWallet(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsCrypted(), JSONRPCError(), pwalletMain, RPC_WALLET_ENCRYPTION_FAILED, RPC_WALLET_WRONG_ENC_STATE, and StartShutdown().

+ Here is the call graph for this function:

void EnsureWalletIsUnlocked ( )

Definition at line 36 of file rpcwallet.cpp.

References CCryptoKeyStore::IsLocked(), JSONRPCError(), pwalletMain, and RPC_WALLET_UNLOCK_NEEDED.

Referenced by dumpprivkey(), dumpwallet(), importprivkey(), importwallet(), keypoolrefill(), sendfrom(), sendmany(), sendtoaddress(), signmessage(), and signrawtransaction().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value getaccount ( const Array &  params,
bool  fHelp 
)

Definition at line 246 of file rpcwallet.cpp.

References CBitcoinAddress::Get(), HelpExampleCli(), HelpExampleRpc(), CBitcoinAddress::IsValid(), JSONRPCError(), CWallet::mapAddressBook, pwalletMain, and RPC_INVALID_ADDRESS_OR_KEY.

+ Here is the call graph for this function:

CBitcoinAddress GetAccountAddress ( string  strAccount,
bool  bForceNew = false 
)

Definition at line 113 of file rpcwallet.cpp.

References CPubKey::GetID(), CWallet::GetKeyFromPool(), CPubKey::IsValid(), JSONRPCError(), CWallet::mapWallet, pwalletMain, CWalletDB::ReadAccount(), RPC_WALLET_KEYPOOL_RAN_OUT, CTxOut::scriptPubKey, CWallet::SetAddressBook(), CScript::SetDestination(), CWallet::strWalletFile, CAccount::vchPubKey, CTransaction::vout, and CWalletDB::WriteAccount().

Referenced by getaccountaddress(), and setaccount().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value getaccountaddress ( const Array &  params,
bool  fHelp 
)

Definition at line 151 of file rpcwallet.cpp.

References AccountFromValue(), GetAccountAddress(), HelpExampleCli(), HelpExampleRpc(), and CBase58Data::ToString().

+ Here is the call graph for this function:

int64_t GetAccountBalance ( CWalletDB walletdb,
const string &  strAccount,
int  nMinDepth 
)

Definition at line 555 of file rpcwallet.cpp.

References CWalletTx::GetAccountAmounts(), CWalletDB::GetAccountCreditDebit(), CMerkleTx::GetBlocksToMaturity(), CMerkleTx::GetDepthInMainChain(), IsFinalTx(), CWallet::mapWallet, and pwalletMain.

Referenced by GetAccountBalance(), getbalance(), sendfrom(), and sendmany().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t GetAccountBalance ( const string &  strAccount,
int  nMinDepth 
)

Definition at line 580 of file rpcwallet.cpp.

References GetAccountBalance(), pwalletMain, and CWallet::strWalletFile.

+ Here is the call graph for this function:

Value getaddressesbyaccount ( const Array &  params,
bool  fHelp 
)

Definition at line 273 of file rpcwallet.cpp.

References AccountFromValue(), HelpExampleCli(), HelpExampleRpc(), CWallet::mapAddressBook, CAddressBookData::name, PAIRTYPE, pwalletMain, and CBase58Data::ToString().

+ Here is the call graph for this function:

Value getbalance ( const Array &  params,
bool  fHelp 
)

Definition at line 587 of file rpcwallet.cpp.

References AccountFromValue(), GetAccountBalance(), CWalletTx::GetAmounts(), CWallet::GetBalance(), CMerkleTx::GetBlocksToMaturity(), CMerkleTx::GetDepthInMainChain(), HelpExampleCli(), HelpExampleRpc(), CWalletTx::IsTrusted(), CWallet::mapWallet, PAIRTYPE, pwalletMain, and ValueFromAmount().

+ Here is the call graph for this function:

Value getnewaddress ( const Array &  params,
bool  fHelp 
)

Definition at line 74 of file rpcwallet.cpp.

References AccountFromValue(), CPubKey::GetID(), CWallet::GetKeyFromPool(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsLocked(), JSONRPCError(), pwalletMain, RPC_WALLET_KEYPOOL_RAN_OUT, CWallet::SetAddressBook(), CWallet::TopUpKeyPool(), and CBase58Data::ToString().

+ Here is the call graph for this function:

Value getrawchangeaddress ( const Array &  params,
bool  fHelp 
)

Definition at line 179 of file rpcwallet.cpp.

References CPubKey::GetID(), CReserveKey::GetReservedKey(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsLocked(), JSONRPCError(), CReserveKey::KeepKey(), pwalletMain, RPC_WALLET_ERROR, CWallet::TopUpKeyPool(), and CBase58Data::ToString().

+ Here is the call graph for this function:

Value getreceivedbyaccount ( const Array &  params,
bool  fHelp 
)

Definition at line 503 of file rpcwallet.cpp.

References AccountFromValue(), COIN, ExtractDestination(), CWallet::GetAccountAddresses(), CMerkleTx::GetDepthInMainChain(), HelpExampleCli(), HelpExampleRpc(), CTransaction::IsCoinBase(), IsFinalTx(), IsMine(), CWallet::mapWallet, CTxOut::nValue, pwalletMain, CTxOut::scriptPubKey, and CTransaction::vout.

+ Here is the call graph for this function:

Value getreceivedbyaddress ( const Array &  params,
bool  fHelp 
)
Value gettransaction ( const Array &  params,
bool  fHelp 
)
Value getunconfirmedbalance ( const Array &  params,
bool  fHelp 
)

Definition at line 656 of file rpcwallet.cpp.

References CWallet::GetUnconfirmedBalance(), pwalletMain, and ValueFromAmount().

+ Here is the call graph for this function:

Value getwalletinfo ( const Array &  params,
bool  fHelp 
)

Definition at line 1890 of file rpcwallet.cpp.

References CWallet::GetBalance(), CWallet::GetKeyPoolSize(), CWallet::GetOldestKeyPoolTime(), CWallet::GetVersion(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsCrypted(), CWallet::mapWallet, nWalletUnlockTime, pwalletMain, and ValueFromAmount().

+ Here is the call graph for this function:

std::string HelpRequiringPassphrase ( )

Definition at line 29 of file rpcwallet.cpp.

References CCryptoKeyStore::IsCrypted(), and pwalletMain.

Referenced by keypoolrefill(), sendfrom(), sendmany(), sendtoaddress(), signmessage(), and signrawtransaction().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value keypoolrefill ( const Array &  params,
bool  fHelp 
)

Definition at line 1522 of file rpcwallet.cpp.

References EnsureWalletIsUnlocked(), CWallet::GetKeyPoolSize(), HelpExampleCli(), HelpExampleRpc(), HelpRequiringPassphrase(), JSONRPCError(), pwalletMain, RPC_INVALID_PARAMETER, RPC_WALLET_ERROR, and CWallet::TopUpKeyPool().

+ Here is the call graph for this function:

Value listaccounts ( const Array &  params,
bool  fHelp 
)
Value listaddressgroupings ( const Array &  params,
bool  fHelp 
)

Definition at line 351 of file rpcwallet.cpp.

References CWallet::cs_wallet, CWallet::GetAddressBalances(), CWallet::GetAddressGroupings(), HelpExampleCli(), HelpExampleRpc(), LOCK, CWallet::mapAddressBook, pwalletMain, and ValueFromAmount().

+ Here is the call graph for this function:

Value listlockunspent ( const Array &  params,
bool  fHelp 
)

Definition at line 1822 of file rpcwallet.cpp.

References base_uint< BITS >::GetHex(), COutPoint::hash, HelpExampleCli(), HelpExampleRpc(), CWallet::ListLockedCoins(), COutPoint::n, and pwalletMain.

+ Here is the call graph for this function:

Value ListReceived ( const Array &  params,
bool  fByAccounts 
)

Definition at line 932 of file rpcwallet.cpp.

References ExtractDestination(), CMerkleTx::GetDepthInMainChain(), CTransaction::GetHash(), base_uint< BITS >::GetHex(), CTransaction::IsCoinBase(), IsFinalTx(), IsMine(), CWallet::mapAddressBook, CWallet::mapWallet, CAddressBookData::name, tallyitem::nAmount, tallyitem::nConf, CTxOut::nValue, PAIRTYPE, pwalletMain, CTxOut::scriptPubKey, CBase58Data::ToString(), tallyitem::txids, ValueFromAmount(), and CTransaction::vout.

Referenced by listreceivedbyaccount(), and listreceivedbyaddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value listreceivedbyaccount ( const Array &  params,
bool  fHelp 
)

Definition at line 1062 of file rpcwallet.cpp.

References HelpExampleCli(), HelpExampleRpc(), and ListReceived().

+ Here is the call graph for this function:

Value listreceivedbyaddress ( const Array &  params,
bool  fHelp 
)

Definition at line 1032 of file rpcwallet.cpp.

References HelpExampleCli(), HelpExampleRpc(), and ListReceived().

+ Here is the call graph for this function:

Value listsinceblock ( const Array &  params,
bool  fHelp 
)

Definition at line 1355 of file rpcwallet.cpp.

References chainActive, CBlockIndex::GetBlockHash(), CMerkleTx::GetDepthInMainChain(), base_uint< BITS >::GetHex(), CChain::Height(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), ListTransactions(), mapBlockIndex, CWallet::mapWallet, CBlockIndex::nHeight, pwalletMain, RPC_INVALID_PARAMETER, and base_uint< BITS >::SetHex().

+ Here is the call graph for this function:

void ListTransactions ( const CWalletTx wtx,
const string &  strAccount,
int  nMinDepth,
bool  fLong,
Array &  ret 
)

Definition at line 1098 of file rpcwallet.cpp.

References CWalletTx::GetAmounts(), CMerkleTx::GetBlocksToMaturity(), CMerkleTx::GetDepthInMainChain(), CTransaction::IsCoinBase(), CWallet::mapAddressBook, MaybePushAddress(), PAIRTYPE, pwalletMain, ValueFromAmount(), and WalletTxToJSON().

Referenced by gettransaction(), listsinceblock(), and listtransactions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value listtransactions ( const Array &  params,
bool  fHelp 
)

Definition at line 1178 of file rpcwallet.cpp.

References AcentryToJSON(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), ListTransactions(), CWallet::OrderedTxItems(), pwalletMain, and RPC_INVALID_PARAMETER.

+ Here is the call graph for this function:

Value lockunspent ( const Array &  params,
bool  fHelp 
)

Definition at line 1743 of file rpcwallet.cpp.

References HelpExampleCli(), HelpExampleRpc(), IsHex(), JSONRPCError(), CWallet::LockCoin(), pwalletMain, RPC_INVALID_PARAMETER, RPCTypeCheck(), CWallet::UnlockAllCoins(), and CWallet::UnlockCoin().

+ Here is the call graph for this function:

static void LockWallet ( CWallet pWallet)
static

Definition at line 1554 of file rpcwallet.cpp.

References CCryptoKeyStore::Lock(), LOCK, and nWalletUnlockTime.

Referenced by walletpassphrase().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void MaybePushAddress ( Object &  entry,
const CTxDestination dest 
)
static

Definition at line 1091 of file rpcwallet.cpp.

References CBitcoinAddress::Set(), and CBase58Data::ToString().

Referenced by ListTransactions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value movecmd ( const Array &  params,
bool  fHelp 
)
Value sendfrom ( const Array &  params,
bool  fHelp 
)
Value sendmany ( const Array &  params,
bool  fHelp 
)
Value sendtoaddress ( const Array &  params,
bool  fHelp 
)
Value setaccount ( const Array &  params,
bool  fHelp 
)

Definition at line 209 of file rpcwallet.cpp.

References AccountFromValue(), CBitcoinAddress::Get(), GetAccountAddress(), HelpExampleCli(), HelpExampleRpc(), CBitcoinAddress::IsValid(), JSONRPCError(), CWallet::mapAddressBook, pwalletMain, RPC_INVALID_ADDRESS_OR_KEY, and CWallet::SetAddressBook().

+ Here is the call graph for this function:

Value settxfee ( const Array &  params,
bool  fHelp 
)

Definition at line 1866 of file rpcwallet.cpp.

References AmountFromValue(), HelpExampleCli(), HelpExampleRpc(), and nTransactionFee.

+ Here is the call graph for this function:

Value signmessage ( const Array &  params,
bool  fHelp 
)
Value walletlock ( const Array &  params,
bool  fHelp 
)

Definition at line 1657 of file rpcwallet.cpp.

References HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsCrypted(), JSONRPCError(), CCryptoKeyStore::Lock(), LOCK, nWalletUnlockTime, pwalletMain, and RPC_WALLET_WRONG_ENC_STATE.

+ Here is the call graph for this function:

Value walletpassphrase ( const Array &  params,
bool  fHelp 
)

Definition at line 1561 of file rpcwallet.cpp.

References GetTime(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsCrypted(), JSONRPCError(), LOCK, LockWallet(), nWalletUnlockTime, pwalletMain, RPC_WALLET_PASSPHRASE_INCORRECT, RPC_WALLET_WRONG_ENC_STATE, RPCRunLater(), CWallet::TopUpKeyPool(), and CWallet::Unlock().

+ Here is the call graph for this function:

Value walletpassphrasechange ( const Array &  params,
bool  fHelp 
)

Definition at line 1616 of file rpcwallet.cpp.

References CWallet::ChangeWalletPassphrase(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsCrypted(), JSONRPCError(), pwalletMain, RPC_WALLET_PASSPHRASE_INCORRECT, and RPC_WALLET_WRONG_ENC_STATE.

+ Here is the call graph for this function:

void WalletTxToJSON ( const CWalletTx wtx,
Object &  entry 
)

Definition at line 42 of file rpcwallet.cpp.

References CWalletTx::GetConflicts(), CMerkleTx::GetDepthInMainChain(), CTransaction::GetHash(), base_uint< BITS >::GetHex(), CWalletTx::GetTxTime(), CMerkleTx::hashBlock, CTransaction::IsCoinBase(), mapBlockIndex, CWalletTx::mapValue, CMerkleTx::nIndex, CWalletTx::nTimeReceived, and PAIRTYPE.

Referenced by gettransaction(), and ListTransactions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

CCriticalSection cs_nWalletUnlockTime
static

Definition at line 27 of file rpcwallet.cpp.

int64_t nWalletUnlockTime

Definition at line 26 of file rpcwallet.cpp.

Referenced by getinfo(), getwalletinfo(), LockWallet(), walletlock(), and walletpassphrase().