aboutsummaryrefslogtreecommitdiff
path: root/src/rpcserver.cpp
AgeCommit message (Collapse)Author
2015-07-27rpc: Accept strings in AmountFromValueWladimir J. van der Laan
Accept strings containing decimal values, in addition to bare values. Useful from JSON-RPC implementations where it's not possible to have direct control over the text of numbers (e.g. where numbers are always doubles), and it's still desired to send an exact value. This would allow users to post JSON content with numbers encoded like `{"value": "0.00000001"}` instead of `{"value": 0.00000001}` which some php/python encoders wrap into 1e-8, or worse.
2015-07-18univalue: Avoid unnecessary roundtrip through double for numbersWladimir J. van der Laan
JSON makes no distinction between numbers and reals, and our code doesn't need to do so either. This removes VREAL, as well as its specific post-processing in `UniValue::write`. Non-monetary amounts do not need to be forcibly formatted with 8 decimals, so the extra roundtrip was unnecessary (and potentially loses precision).
2015-07-18rpc: Make ValueFromAmount always return 8 decimalsWladimir J. van der Laan
This is the format that was always returned to JSON clients. The difference was not noticed before, because VREAL values are post-processed by univalue. By implementing the functionality directly it breaks the dependency of rpcserver on utilmoneystr. FormatMoney is now only used for debugging purposes. To test, port over the formatting tests from util_tests.cpp to rpc_tests.cpp.
2015-07-13rpc: Implement random-cookie based authenticationWladimir J. van der Laan
When no `-rpcpassword` is specified, use a special 'cookie' file for authentication. This file is generated with random content when the daemon starts, and deleted when it exits. Read access to this file controls who can access through RPC. By default this file is stored in the data directory but it be overriden with `-rpccookiefile`. This is similar to Tor CookieAuthentication: see https://www.torproject.org/docs/tor-manual.html.en Alternative to #6258. Like that pull, this allows running bitcoind without any manual configuration. However, daemons should ideally never write to their configuration files, so I prefer this solution.
2015-07-13Merge pull request #6398Wladimir J. van der Laan
85ee55b rpc: Remove chain-specific RequireRPCPassword (Wladimir J. van der Laan)
2015-07-10rpc: Accept scientific notation for monetary amounts in JSONWladimir J. van der Laan
Add a function `ParseFixedPoint` that parses numbers according to the JSON number specification and returns a 64-bit integer. Then this in `AmountFromValue`, rather than `ParseMoney`. Also add lots of tests (thanks to @jonasschnelli for some of them). Fixes issue #6297.
2015-07-10rpc: Remove chain-specific RequireRPCPasswordWladimir J. van der Laan
I've never liked the chain-specific exception to having to set a password. It gives issues with #6388 which makes it valid to set no password in every case (as it enables random cookie authentication). This pull removes the flag, so that all chains are regarded the same. It also removes the username==password test, which doesn't provide any substantial extra security.
2015-07-02Merge pull request #6362Wladimir J. van der Laan
72b9452 When processing RPC commands during warmup phase, parse the request object before returning an error so that id value can be used in the response. (Forrest Voight)
2015-07-02Merge pull request #6247Wladimir J. van der Laan
076badb Add getblockheader RPC call (Peter Todd)
2015-07-01When processing RPC commands during warmup phase, parse theForrest Voight
request object before returning an error so that id value can be used in the response. Prior to this commit, RPC commands sent during Bitcoin's warmup/startup phase were responded to with a JSON-RPC error with an id of null, which violated the JSON-RPC 2.0 spec: id: This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
2015-06-30detach wallet from minerJonas Schnelli
2015-06-23Merge pull request #6088Wladimir J. van der Laan
2085895 fundrawtransaction tests (Jonas Schnelli) 21bbd92 Add fundrawtransaction RPC method (Matt Corallo) 1e0d1a2 Add FundTransaction method to wallet (Matt Corallo) 2d84e22 Small tweaks to CCoinControl for fundrawtransaction (Matt Corallo) 9b4e7d9 Add DummySignatureCreator which just creates zeroed sigs (Pieter Wuille)
2015-06-17[RPC] add setban/listbanned/clearbanned RPC commandsJonas Schnelli
2015-06-16New RPC command disconnectnodeAlex van der Peet
2015-06-11Add fundrawtransaction RPC methodMatt Corallo
2015-06-06Get rid of fPlus argument to FormatMoneyWladimir J. van der Laan
It's never used with any other value than false, the default.
2015-06-06Don't go through double in AmountFromValue and ValueFromAmountWladimir J. van der Laan
My prime gripe with JSON spirit was that monetary values still had to be converted from and to floating point which can cause deviations (see #3759 and https://bitcoin.stackexchange.com/questions/22716/bitcoind-sendfrom-round-amount-error). As UniValue stores internal values as strings, this is no longer necessary. This avoids risky double-to-integer and integer-to-double conversions completely, and results in more elegant code to boot.
2015-06-05Add getblockheader RPC callPeter Todd
Alternative to getblock that works even when the block itself has been pruned, returning all available information.
2015-06-04use const references where appropriatePhilip Kaufmann
2015-06-04fix rpc batching univalue issueJonas Schnelli
2015-06-04Remove JSON Spirit wrapper, remove JSON Spirit leftoversJonas Schnelli
- implement find_value() function for UniValue - replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper - remove JSON Spirit sources
2015-06-04remove JSON Spirit UniValue wrapperJonas Schnelli
2015-06-04expicit set UniValue type to avoid empty valuesJonas Schnelli
2015-06-04Convert tree to using univalue. Eliminate all json_spirit uses.Jeff Garzik
2015-05-06Merge pull request #5420Wladimir J. van der Laan
6b4feb8 [QA] rest.py RPC test: change setgenerate() to generate() (Jonas Schnelli) 97ee866 [REST] getutxos REST command (based on Bip64) (Jonas Schnelli)
2015-05-02Non-grammatical language improvementsLuke Dashjr
2015-04-23Add RPC call to generate and verify merkle blocksMatt Corallo
2015-04-21[REST] getutxos REST command (based on Bip64)Jonas Schnelli
has parts of @mhearn #4351 * allows querying the utxos over REST * same binary input and outputs as mentioned in Bip64 * input format = output format * various rpc/rest regtests
2015-04-12Push down RPC reqWallet flagJonas Schnelli
2015-04-01Introduce separate 'generate' RPC callPieter Wuille
2015-03-24Regression test for ResendWalletTransactionsGavin Andresen
Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions." I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived). I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by: 1. Running bitcoind -connect=0.0.0.0:8333 2. Creating a couple of send-to-self transactions 3. Connect to a peer using -addnode 4. Waited a while, monitoring debug.log, until I see: ```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions``` One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
2015-03-12[Move Only] Move wallet related things to src/wallet/Jonas Schnelli
could once be renamed from /src/wallet to /src/legacywallet.
2015-02-08Sanitize command strings before logging them.Gregory Maxwell
Normally bitcoin core does not display any network originated strings without sanitizing or hex encoding. This wasn't done for strcommand in many places. This could be used to play havoc with a terminal displaying the logs, especially with printtoconsole in use. Thanks to Evil-Knievel for reporting this issue.
2015-01-28Trim RPC command tableWladimir J. van der Laan
- invalidateblock and reconsiderblock were defined doubly - remove no-longer-used threadSafe, as locks have been pushed down
2015-01-28Removed main.h dependency from rpcserver.cppEric Lombrozo
Rebased by @laanwj: - update for RPC methods added since 84d13ee: setmocktime, invalidateblock, reconsiderblock. Only the first, setmocktime, required a change, the other two are thread safe.
2015-01-24Merge pull request #5599Wladimir J. van der Laan
0cc0d8d Get rid of the internal miner's hashmeter (jtimon)
2015-01-16Restore RPC HTTP keepalives to default.Gregory Maxwell
This avoids a regression for issues like #334 where high speed repeated connections eventually run the HTTP client out of sockets because all of theirs end up in time_wait. Maybe the trade-off here is suboptimal, but if both choices will fail then we prefer fewer changes until the root cause is solved.
2015-01-14Add a -rpckeepalive and disable RPC use of HTTP persistent connections.Gregory Maxwell
It turns out that some miners have been staying with old versions of Bitcoin Core because their software behaves poorly with persistent connections and the Bitcoin Core thread and connection limits. What happens is that underlying HTTP libraries leave connections open invisibly to their users and then the user runs into the default four thread limit. This looks like Bitcoin Core is unresponsive to RPC. There are many things that should be improved in Bitcoin Core's behavior here, e.g. supporting more concurrent connections, not tying up threads for idle connections, disconnecting kept-alive connections when limits are reached, etc. All are fairly big, risky changes. Disabling keep-alive is a simple workaround. It's often not easy to turn off the keep-alive support in the client where it may be buried in some platform library. If you are one of the few who really needs persistent connections you probably know that you want them and can find a switch; while if you don't and the misbehavior is hitting you it is hard to discover the source of your problems is keepalive related. Given that it is best to default to off until they're handled better.
2015-01-04Get rid of the internal miner's hashmeterjtimon
2015-01-02namespace: remove boost namespace pollutionCory Fields
2014-12-29rpcserver: attempt to fix uncaught exception.Cory Fields
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-17make all catch() arguments constPhilip Kaufmann
- I saw this on http://en.cppreference.com/w/cpp/language/try_catch and thought it would be a good idea - also unify used format to better be able to search for exception uses in our codebase
2014-12-06Disable SSLv3 (in favor of TLS) for the RPC client and server.Gregory Maxwell
TLS is subject to downgrade attacks when SSLv3 is available, and SSLv3 has vulnerabilities. The popular solution is to disable SSLv3. On the web this breaks some tiny number of very old clients. While Bitcoin RPC shouldn't be exposed to the open Internet, it also shouldn't be exposed to really old SSL implementations, so it shouldn't be a major issue for us to disable SSLv3. There is more information on the downgrade attacks and disabling SSLv3 at https://disablessl3.com/ .
2014-12-02Merge pull request #5369Gavin Andresen
b2d0162 Test resurrecting memory pool transactions during chain re-org (Gavin Andresen) 3dd8ed7 Delay writing block indexes in invalidate/reconsider (Pieter Wuille) 798faec Add 'invalidateblock' and 'reconsiderblock' RPC commands. (Pieter Wuille)
2014-11-28Move `setmocktime` to hidden categoryWladimir J. van der Laan
Another testing-only potential footgun command.
2014-11-26Introduce a hidden categoryPieter Wuille
2014-11-26Add 'invalidateblock' and 'reconsiderblock' RPC commands.Pieter Wuille
These can be used for testing reorganizations or for manual intervention in case of chain forks.
2014-11-26[REST] set REST API behind "-rest" optionJonas Schnelli
2014-11-26[REST] give an appropriate response in warmup phaseJonas Schnelli