aboutsummaryrefslogtreecommitdiff
path: root/src/rpcserver.cpp
AgeCommit message (Collapse)Author
2014-06-28fix RPC error replieskazcw
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.
2014-06-28Replace HexBits with strprintfjtimon
2014-06-27minor code format fix in rpc-related filesPhilip Kaufmann
2014-06-26RPC code movement: separate out JSON-RPC execution logic from HTTP server logicJeff Garzik
2014-06-26RPC cleanup: Improve HTTP server repliesJeff Garzik
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
2014-06-26JSON-RPC method: prioritisetransaction <txid> <priority delta> <priority tx fee>Luke Dashjr
Accepts the transaction into mined blocks at a higher (or lower) priority
2014-06-25Remove unnecessary dependencies for bitcoin-cliWladimir J. van der Laan
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.
2014-06-21Remove getwork() RPC callPieter Wuille
2014-06-19rpc: Add acceptors only when listening succeededWladimir J. van der Laan
2014-06-19rpc: Ignore and log errors during cancelWladimir J. van der Laan
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.
2014-06-09Push cs_mains down in ProcessBlockPieter Wuille
2014-06-06estimatefee / estimatepriority RPC methodsGavin Andresen
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.
2014-05-13Add -rpcbind option to allow binding RPC port on a specific interfaceWladimir J. van der Laan
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.
2014-05-12rpc: keep track of acceptors, and cancel them in StopRPCThreadsWladimir J. van der Laan
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.
2014-05-12rpc: Make sure conn object is always cleaned upWladimir J. van der Laan
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).
2014-05-12rpc: pass errors from async_acceptWladimir J. van der Laan
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.
2014-05-09Add tests for BoostAsioToCNetAddrWladimir J. van der Laan
2014-05-09rpc: Use netmasks instead of wildcards for IP address matchingWladimir J. van der Laan
`-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.
2014-05-06rpc: add `getblockchaininfo` and `getnetworkinfo`Wladimir J. van der Laan
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)
2014-03-31Organize RPCCommands tableWladimir J. van der Laan
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.
2014-03-24Fix regression testsGavin Andresen
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.
2014-03-10Merge pull request #3717 from djpnewton/wallet-txcountJeff Garzik
add getwalletinfo RPC call with wallet transaction count
2014-03-07Remove unused includes of boost lexical_castWladimir J. van der Laan
We don't use lexical_cast anywhere, no need to include it.
2014-02-27move wallet info stuff to "getwalletinfo" rpc (left original walletDaniel Newton
stuff in getinfo call for backwards compatibility) add wallet transaction count to getwalletinfo rpc call
2014-02-09Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron
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.
2014-01-23Remove redundant .c_str()sWladimir J. van der Laan
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.
2014-01-17qt: allow `walletpassphrase` in debug console without -serverWladimir J. van der Laan
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.
2014-01-11small headers ordering cleanupPhilip Kaufmann
- keep headers in alphabetical order - fix Makefile.am (2 files in 1 line - leftover) - remove some spaces etc.
2013-12-20Merge pull request #3369Wladimir J. van der Laan
6027b46 Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balance (Michael Bauer)
2013-12-13Move `verifymessage` from rpcwallet to rpcmiscWladimir J. van der Laan
Enables it in --disable-wallet compiles.
2013-12-13Move `createmultisig` from rpcwallet to rpcmiscWladimir J. van der Laan
Enables it in --disable-wallet compiles.
2013-12-13Move `validateaddress` from rpcwallet to rpcmiscWladimir J. van der Laan
Enables it in --disable-wallet compiles. Delimit wallet-using part using #ifdef ENABLE_WALLET.
2013-12-13Move `settxfee` from rpcblockchain to rpcwalletWladimir J. van der Laan
`settxfee` only affects the wallet, not the block chain.
2013-12-09Allow mining RPCs with --disable-walletWladimir J. van der Laan
The following mining-related RPC calls don't use the wallet: - getnetworkhashps - getmininginfo - getblocktemplate - submitblock Enable them when compiling with --disable-wallet.
2013-12-08Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balanceMichael Bauer
Conflicts: src/rpcserver.cpp
2013-12-04Delimit code with #ifdef ENABLE_WALLETWladimir J. van der Laan
Delimit all code that uses the wallet functions in implementation files that conditionally use the wallet.
2013-12-04Move HelpExample* from rpcwallet to rpcserverWladimir J. van der Laan
General functions used throughout the RPC framework don't belong in rpcwallet.
2013-11-27Split up bitcoinrpc (code movement only)Wladimir J. van der Laan
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.