aboutsummaryrefslogtreecommitdiff
path: root/src/rpcserver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* | Delimit code with #ifdef ENABLE_WALLETWladimir J. van der Laan2013-12-041-14/+31
| | | | | | | | | | Delimit all code that uses the wallet functions in implementation files that conditionally use the wallet.
* | Move HelpExample* from rpcwallet to rpcserverWladimir J. van der Laan2013-12-041-0/+9
|/ | | | | General functions used throughout the RPC framework don't belong in rpcwallet.
* Split up bitcoinrpc (code movement only)Wladimir J. van der Laan2013-11-271-0/+823
Split bitcoinrpc up into - rpcserver: bitcoind RPC server - rpcclient: bitcoin-cli RPC client - rpcprotocol: shared common HTTP/JSON-RPC protocol code One step towards making bitcoin-cli independent from the rest of the code, and thus a smaller executable that doesn't have to be linked against leveldb. This commit only does code movement, there are no functional changes.