aboutsummaryrefslogtreecommitdiff
path: root/src/rpcserver.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-0/+6
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* Don't reveal whether password is <20 or >20 characters in RPCWladimir J. van der Laan2014-08-191-3/+2
| | | | | | | As discussed on IRC. It seems bad to base a decision to delay based on the password length, as it leaks a small amount of information.
* Closely track mempool byte total. Add "getmempoolinfo" RPC.Jeff Garzik2014-08-141-0/+1
| | | | | Goal: Gain live insight into the mempool. Groundwork for future work that caps mempool size.
* Categorize rpc help overviewCozz Lovan2014-08-111-85/+106
| | | | | | | | | Conflicts: src/rpcserver.cpp Github-Pull: #4539 Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: df3d321
* Remove size limit in RPC client, keep it in serverWladimir J. van der Laan2014-08-061-1/+1
| | | | | | | | | | The size limit makes a lot of sense for the server, as it never has to accept very large data. The client, however, can request arbitrary amounts of data with `listtransactions` on a large wallet. Fixes #4604.
* Avoid a copy in RPC outputWladimir J. van der Laan2014-08-061-1/+1
| | | | | | | | Split up HTTPReply into HTTPReply and HTTPReplyHeader, so that the message data can be streamed directly. Also removes a c_str(), which would have prevented binary output with NUL characters in it.
* Implement "getchaintips" RPC command to monitor blockchain forks.Daniel Kraft2014-08-031-0/+1
| | | | | | | | Port over https://github.com/chronokings/huntercoin/pull/19 from Huntercoin: This implements a new RPC command "getchaintips" that can be used to find all currently active chain heads. This is similar to the -printblocktree startup option, but it can be used without restarting just via the RPC interface on a running daemon.
* Merge pull request #4400Wladimir J. van der Laan2014-07-141-1/+1
|\ | | | | | | | | | | 4eedf4f make RandAddSeed() use OPENSSL_cleanse() (Philip Kaufmann) 6354935 move rand functions from util to new random.h/.cpp (Philip Kaufmann) 001a53d add GetRandBytes() as wrapper for RAND_bytes() (Philip Kaufmann)
| * add GetRandBytes() as wrapper for RAND_bytes()Philip Kaufmann2014-07-091-1/+1
| | | | | | | | | | | | - add a small wrapper in util around RAND_bytes() and replace with GetRandBytes() in the code to log errors from calling RAND_bytes() - remove OpenSSL header rand.h where no longer needed
* | Merge pull request #4503Wladimir J. van der Laan2014-07-141-0/+11
|\ \ | | | | | | | | | | | | b45a6e8 Add test for getblocktemplate longpolling (Wladimir J. van der Laan) ff6a7af getblocktemplate: longpolling support (Luke Dashjr)
| * | getblocktemplate: longpolling supportLuke Dashjr2014-07-111-0/+11
| |/
* / Clean up RPCs that are disabled in safe-mode.Gregory Maxwell2014-07-101-19/+19
|/ | | | | | | | | | | | | | | | This removes some inconsistencies in what worked and didn't work in safemode. Now only RPCs involved in getting balances or sending funds are disabled. Previously you could mine but not submit blocks— but we may need more blocks to resolve a fork that triggered safe mode in the first place, and the non-submission was not reliable since some miners submit blocks via multiple means. There were also a number of random commands disabled that had nothing to do with the blockchain like verifymessage. Thanks to earlz for pointing out that there were some moderately cheap ways to maliciously trigger safe mode, which brought attention to the fact that safemode wasn't used in a very intelligent way.
* Merge pull request #4045Wladimir J. van der Laan2014-07-071-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a3e192a replaced MINE_ with ISMINE_ (JaSK) 53a2148 fixed bug where validateaddress doesn't display information (JaSK) f28707a fixed bug in ListReceived() (JaSK) 519dd1c Added MINE_ALL = (spendable|watchonly) (JaSK) 23b0506 Fixed some stuff in TransactionDesc (JaSK) 80dda36 removed default argument values for ismine filter (JaSK) d5087d1 Use script matching rather than destination matching for watch-only. (Pieter Wuille) 0fa2f88 added includedWatchonly argument to listreceivedbyaddress/...account (JaSK) f87ba3d added includeWatchonly argument to 'gettransaction' because it affects balance calculation (JaSK) a5c6c5d fixed tiny glitch and improved readability like laanwj suggested (JaSK) d7d5d23 Added argument to listtransactions and listsinceblock to include watchonly addresses (JaSK) 952877e Showing 'involvesWatchonly' property for transactions returned by 'listtransactions' and 'listsinceblock'. It is only appended when the transaction involves a watchonly address. (JaSK) 83f3543 Added argument to listaccounts to include watchonly addresses (JaSK) d4640d7 Added argument to getbalance to include watchonly addresses and fixed errors in balance calculation. (JaSK) d2692f6 Watchonly transactions are marked in transaction history (JaSK) ffd40da Watchonly balances are shown separately in gui. (JaSK) 2935b21 qt: Hide unspendable outputs in coin control (Wladimir J. van der Laan) c898846 Add support for watch-only addresses (Pieter Wuille)
| * Add support for watch-only addressesPieter Wuille2014-07-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: * Add Add/Have WatchOnly methods to CKeyStore, and implementations in CBasicKeyStore. * Add similar methods to CWallet, and support entries for it in CWalletDB. * Make IsMine in script/wallet return a new enum 'isminetype', rather than a boolean. This allows distinguishing between spendable and unspendable coins. * Add a field fSpendable to COutput (GetAvailableCoins' return type). * Mark watchonly coins in listunspent as 'watchonly': true. * Add 'watchonly' to validateaddress, suppressing script/pubkey/... in this case. Based on a patch by Eric Lombrozo. Conflicts: src/qt/walletmodel.cpp src/rpcserver.cpp src/wallet.cpp
* | Clarify error message when invalid -rpcallowipWladimir J. van der Laan2014-07-031-1/+1
|/ | | | Also add to HelpMessage() what specifications are valid.
* fix RPC error replieskazcw2014-06-281-4/+4
| | | | | | | | | | | | | After pull #4288, RPC messages indicating errors have a Content-Length unrelated to their actual contents, rendering bitcoin-cli and curl unable to decode the reply. This patch sets the Content-Length field based on the actual content returned. Additionally, pull #4288 clobbered the error descriptions provided in ErrorReply, which bitcoin-cli relies upon; this patch moves #4288 http-error descriptions to an HTTPError method, allowing HTTPReply to pass content on unchanged.
* Replace HexBits with strprintfjtimon2014-06-281-10/+0
|
* minor code format fix in rpc-related filesPhilip Kaufmann2014-06-271-4/+2
|
* RPC code movement: separate out JSON-RPC execution logic from HTTP server logicJeff Garzik2014-06-261-57/+72
|
* RPC cleanup: Improve HTTP server repliesJeff Garzik2014-06-261-10/+0
| | | | | | | 1) support varying content types 2) support only sending the header 3) properly deliver error message as content, if HTTP error 4) move AcceptedConnection class to header, for wider use
* JSON-RPC method: prioritisetransaction <txid> <priority delta> <priority tx fee>Luke Dashjr2014-06-261-0/+1
| | | | Accepts the transaction into mined blocks at a higher (or lower) priority
* Remove unnecessary dependencies for bitcoin-cliWladimir J. van der Laan2014-06-251-1/+1
| | | | | | | | | This commit removes all the unnecessary dependencies (key, core, netbase, sync, ...) from bitcoin-cli. To do this it shards the chain parameters into BaseParams, which contains just the RPC port and data directory (as used by utils and bitcoin-cli) and Params, with the rest.
* Remove getwork() RPC callPieter Wuille2014-06-211-2/+1
|
* rpc: Add acceptors only when listening succeededWladimir J. van der Laan2014-06-191-1/+1
|
* rpc: Ignore and log errors during cancelWladimir J. van der Laan2014-06-191-2/+11
| | | | | | | | | | Cancelling the RPC acceptors can sometimes result in an error about a bad file descriptor. As this is the shutdown sequence we need to continue nevertheless, ignore these errors, log a warning and proceed. Fixes #4352.
* Push cs_mains down in ProcessBlockPieter Wuille2014-06-091-1/+1
|
* estimatefee / estimatepriority RPC methodsGavin Andresen2014-06-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New RPC methods: return an estimate of the fee (or priority) a transaction needs to be likely to confirm in a given number of blocks. Mike Hearn created the first version of this method for estimating fees. It works as follows: For transactions that took 1 to N (I picked N=25) blocks to confirm, keep N buckets with at most 100 entries in each recording the fees-per-kilobyte paid by those transactions. (separate buckets are kept for transactions that confirmed because they are high-priority) The buckets are filled as blocks are found, and are saved/restored in a new fee_estiamtes.dat file in the data directory. A few variations on Mike's initial scheme: To estimate the fee needed for a transaction to confirm in X buckets, all of the samples in all of the buckets are used and a median of all of the data is used to make the estimate. For example, imagine 25 buckets each containing the full 100 entries. Those 2,500 samples are sorted, and the estimate of the fee needed to confirm in the very next block is the 50'th-highest-fee-entry in that sorted list; the estimate of the fee needed to confirm in the next two blocks is the 150'th-highest-fee-entry, etc. That algorithm has the nice property that estimates of how much fee you need to pay to get confirmed in block N will always be greater than or equal to the estimate for block N+1. It would clearly be wrong to say "pay 11 uBTC and you'll get confirmed in 3 blocks, but pay 12 uBTC and it will take LONGER". A single block will not contribute more than 10 entries to any one bucket, so a single miner and a large block cannot overwhelm the estimates.
* Add -rpcbind option to allow binding RPC port on a specific interfaceWladimir J. van der Laan2014-05-131-35/+60
| | | | | | | | | | | | Add -rpcbind command option to specify binding RPC service on one or multiple specific interfaces. Functionality if -rpcbind is not specified remains the same as before: - If no -rpcallowip specified, bind on localhost - If no -rpcbind specified, bind on any interface Implements part of #3111.
* rpc: keep track of acceptors, and cancel them in StopRPCThreadsWladimir J. van der Laan2014-05-121-3/+14
| | | | | | | | | | Fixes #4156. The problem is that the boost::asio::io_service destructor waits for the acceptors to finish (on windows, and boost 1.55). Fix this by keeping track of the acceptors and cancelling them before stopping the event loops.
* rpc: Make sure conn object is always cleaned upWladimir J. van der Laan2014-05-121-10/+6
| | | | | | | | | | | | | Make sure conn object always gets cleaned up by using a `boost::shared_ptr`. This makes valgrind happy - before this commit, one connection object always leaked at shutdown, as well as can avoid other leaks, when for example an exception happens. Also add an explicit Close() to the !ClientAllowed path to make it similar to the normal path (I'm not sure whether it is needed, but it can't hurt).
* rpc: pass errors from async_acceptWladimir J. van der Laan2014-05-121-1/+3
| | | | | | | | | | | | | According to the [boost::asio documentation](http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/basic_socket_acceptor/async_accept/overload2.html), the function signature of the handler must be: void handler( const boost::system::error_code& error // Result of operation. ); We were binding *all* the arguments, instead of all but the error, resulting in nullary function that never got the error. Fix this by adding an input argument substitution.
* Add tests for BoostAsioToCNetAddrWladimir J. van der Laan2014-05-091-2/+1
|
* rpc: Use netmasks instead of wildcards for IP address matchingWladimir J. van der Laan2014-05-091-14/+49
| | | | | | | | | | | | `-rpcallowip` currently has a wacky wildcard-based format. After this commit it will accept the more standard format, for example: - Ranges with netmask 127.0.0.0/255.255.255.0, ::/0 - Ranges with cidr 12.3.4.5/24, 12:34:56:78:9a:bc:de:00/112 - Loose IPs ::1, 127.0.0.1 Trying to use the old *?-based format will result in an error message at launch.
* rpc: add `getblockchaininfo` and `getnetworkinfo`Wladimir J. van der Laan2014-05-061-0/+2
| | | | | | | | | | | | | Adds two new info query commands that take over information from hodge-podge `getinfo`. Also some new information is added: - `getblockchaininfo` - `chain`: (string) current chain (main, testnet3, regtest) - `verificationprogress: (numeric) estimated verification progress - `chainwork` - `getnetworkinfo` - `localaddresses`: (array) local addresses, from mapLocalHost (fixes #1734)
* Organize RPCCommands tableWladimir J. van der Laan2014-03-311-48/+57
| | | | | | | | | Use sensible categories (overall control, P2P, blockchain/UTXO and mining, wallet, wallet-enabled mining) and sort within each. Also remove unnecessary #ifdef ENABLE_WALLET from `rpcnet.cpp`. Functionality-neutral change.
* Fix regression testsGavin Andresen2014-03-241-1/+1
| | | | | | | Taught bitcoind to close the HTTP connection after it gets a 'stop' command, to make it easier for the regression tests to cleanly stop. Move bitcoinrpc files to correct location. Tidied up the python-based regression tests.
* Merge pull request #3717 from djpnewton/wallet-txcountJeff Garzik2014-03-101-0/+1
|\ | | | | add getwalletinfo RPC call with wallet transaction count
| * move wallet info stuff to "getwalletinfo" rpc (left original walletDaniel Newton2014-02-271-0/+1
| | | | | | | | | | | | stuff in getinfo call for backwards compatibility) add wallet transaction count to getwalletinfo rpc call
* | Remove unused includes of boost lexical_castWladimir J. van der Laan2014-03-071-1/+0
|/ | | | We don't use lexical_cast anywhere, no need to include it.
* Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron2014-02-091-1/+1
| | | | | | in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
* Remove redundant .c_str()sWladimir J. van der Laan2014-01-231-10/+10
| | | | | | | After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
* qt: allow `walletpassphrase` in debug console without -serverWladimir J. van der Laan2014-01-171-0/+15
| | | | | | | | | | | | | | Currently it is only possible to use `walletpassphrase` to unlock the wallet when bitcoin is started in server mode. Almost everything that manipulates the wallet in the RPC console needs the wallet to be unlocked and is thus unusable without -server. This is pretty unintuitive to me, and I'm sure it's even more confusing to users. Solve this with a very minimal change: by making the GUI start a dummy RPC thread just to handle timeouts.
* small headers ordering cleanupPhilip Kaufmann2014-01-111-1/+1
| | | | | | - keep headers in alphabetical order - fix Makefile.am (2 files in 1 line - leftover) - remove some spaces etc.
* Merge pull request #3369Wladimir J. van der Laan2013-12-201-0/+1
|\ | | | | | | 6027b46 Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balance (Michael Bauer)
| * Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balanceMichael Bauer2013-12-081-0/+1
| | | | | | | | | | Conflicts: src/rpcserver.cpp
* | Move `verifymessage` from rpcwallet to rpcmiscWladimir J. van der Laan2013-12-131-1/+1
| | | | | | | | Enables it in --disable-wallet compiles.
* | Move `createmultisig` from rpcwallet to rpcmiscWladimir J. van der Laan2013-12-131-1/+1
| | | | | | | | Enables it in --disable-wallet compiles.
* | Move `validateaddress` from rpcwallet to rpcmiscWladimir J. van der Laan2013-12-131-1/+1
| | | | | | | | | | Enables it in --disable-wallet compiles. Delimit wallet-using part using #ifdef ENABLE_WALLET.
* | Move `settxfee` from rpcblockchain to rpcwalletWladimir J. van der Laan2013-12-131-1/+1
| | | | | | | | `settxfee` only affects the wallet, not the block chain.
* | Allow mining RPCs with --disable-walletWladimir J. van der Laan2013-12-091-7/+12
| | | | | | | | | | | | | | | | | | | | | | The following mining-related RPC calls don't use the wallet: - getnetworkhashps - getmininginfo - getblocktemplate - submitblock Enable them when compiling with --disable-wallet.