Commit graph

49 commits

Author SHA1 Message Date
sje
a6099ef319 Issue #1865 - Clean up RPC help messages
Based on the proposal, update the help message of rpc methods
- strings arguments are in double quotes rather than square brackets
- numeric arguments have no quotes (and no default value)
- optional parameters are surrounded by round brackets
- json arguments are strings but don't use double quotes

Added 3 sections for the details
- Arguments: lists each argument, it's type, required or not, a default, and a description
- Result: The method result, with json format if applicable, type, and a description
- Examples: examples calls using bitcoin-cli and curl for json rpc call

Problems
- maybe this is too verbose
- lines might be too long
- description are not good or complete
- examples may be too much
2013-11-13 14:54:29 +01:00
Brandon Dahler
51ed9ec971 Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
2013-11-10 09:36:28 -06:00
Philip Kaufmann
4315ec1a72 RPC: error code changes and prevent crash with walletpassphrase
- fix crash with walletpassphrase by checking if RPC server is running and
  give a friendly error message how to fix this (fixes #3100)
- add 3 new RPCErrorCodes RPC_SERVER_NOT_STARTED, RPC_NODE_ALREADY_ADDED
  and RCP_NODE_NOT_ADDED (I checked the source to not use a number already
  in use for RPC_SERVER_NOT_STARTED)
- use the new codes where needed / missing
- add missing use of RPC_INVALID_PARAMETER
2013-10-24 09:03:02 +02:00
Pieter Wuille
9b1200c23b
Merge pull request #3119
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20 22:25:44 +02:00
super3
db0e8ccd90 Bump Year Number to 2013 2013-10-20 15:25:06 -04:00
Scott Ellis
ce14345a89 Add network traffic graph 2013-10-14 19:02:03 +11:00
Josh Lehan
971bb3e901 Added ping time measurement.
New RPC "ping" command to request ping.
Implemented "pong" message handler.
New "pingtime" field in getpeerinfo, to provide results to user.
New "pingwait" field, to show pings still in flight, to better see newly lagging peers.
2013-10-04 01:30:12 -07:00
Jeff Garzik
b0730874d9 Support absence of wallet (pwalletMain==NULL) in several locations,
notably RPC.
2013-10-01 16:14:37 -04:00
Jeff Garzik
19c415b1cf Merge pull request #2888 from litecoin-project/getnetworkhashps
Add getnetworkhashps to get the estimated network hashrate
2013-10-01 07:09:04 -07:00
coblee
d64eef48a4 Add getnetworkhashps to get the calculated network hashrate 2013-09-17 11:15:02 +08:00
Peter Todd
be066fad7d Add RPC call decodescript 2013-09-12 22:53:54 -04:00
Peter Todd
463c9710f5 Move Parse{Hash|Hex} to be usable by all RPC code 2013-09-12 22:53:54 -04:00
Jeff Garzik
e5e9904c1c RPC: add getrawchangeaddress, for raw transaction change destinations 2013-08-28 16:29:52 -04:00
Jeff Garzik
091aa8dae9 RPC: add getbestblockhash, to return tip of best chain 2013-07-03 11:02:29 -04:00
Pieter Wuille
ee4949794b Merge pull request #2592 from sipa/dumpwallet
Add dumpwallet and importwallet RPC commands
2013-06-23 12:10:17 -07:00
Pieter Wuille
4e534aa9d8 Add dumpwallet and importwallet RPCs
dumpwallet: produce a dump of all keys in a wallet, in a format
compatible with Bitcoin Wallet for Android and Multibit.

importwallet: import such a dump
2013-06-22 17:30:56 +02:00
Jeff Garzik
f590653377 RPC: add 'verifychain', to verify chain database at runtime 2013-06-19 11:53:02 -04:00
Jeff Garzik
6bc6d57303 Merge pull request #2716 from laanwj/2013_05_30_getwork
Move pMiningKey init out of StartRPCThreads
2013-05-30 09:15:16 -07:00
Jeff Garzik
9c95a2e836 Merge pull request #2625 from gavinandresen/walletlock_asio
Use boost::asio::deadline_timer for walletpassphrase timeout
2013-05-30 08:01:22 -07:00
Wladimir J. van der Laan
d98bf10f23 Move pMiningKey init out of StartRPCThreads
This commit decouples the pMiningKey initialization and shutdown from the RPC
threads.

`getwork` and `getblocktemplate` rely on pMiningKey, and can also be ran
from the debug window in the UI even when the RPC server is not running.

Solves issue #2706.
2013-05-30 16:41:35 +02:00
Gavin Andresen
36e826cea1 Clean up mining CReserveKey to prevent crash at shutdown
Fixes issue#2687
2013-05-23 14:17:15 -04:00
Gavin Andresen
92f2c1fe0f Use boost::asio::deadline_timer for walletpassphrase timeout
New method in bitcoinrpc:  RunLater, that uses a map of deadline
timers to run a function later.

Behavior of walletpassphrase is changed; before, calling
walletpassphrase again before the lock timeout passed
would result in: Error: Wallet is already unlocked.

You would have to call lockwallet before walletpassphrase.

Now: the last walletpassphrase with correct password
wins, and overrides any previous timeout.

Fixes issue# 1961 which was caused by spawning too many threads.

Test plan:

Start with encrypted wallet, password 'foo'
NOTE:
 python -c 'import time; print("%d"%time.time())'
... will tell you current unix timestamp.

Try:

walletpassphrase foo 600
getinfo
EXPECT: unlocked_until is about 10 minutes in the future

walletpassphrase foo 1
sleep 2
sendtoaddress mun74Bvba3B1PF2YkrF4NsgcJwHXXh12LF 11
EXPECT: Error: Please enter the wallet passphrase with walletpassphrase first.

walletpassphrase foo 600
walletpassphrase foo 0
getinfo
EXPECT: wallet is locked (unlocked_until is 0)

walletpassphrase foo 10
walletpassphrase foo 600
getinfo
EXPECT: wallet is unlocked until 10 minutes in future

walletpassphrase foo 60
walletpassphrase bar 600
EXPECT: Error, incorrect passphrase
getinfo
EXPECT: wallet still scheduled to lock 60 seconds from first (successful) walletpassphrase
2013-05-07 11:47:33 -04:00
Gavin Andresen
21eb5adadb Port Thread* methods to boost::thread_group 2013-04-03 19:57:13 -04:00
freewil
10ef361169 CRPCCommand.unlocked -> CRPCCommand.threadSafe
unlocked could be confused with wallet encryption
2013-03-07 06:18:55 -05:00
Matt Corallo
67a11bd6c5 Add a getaddednodeinfo RPC. 2013-01-27 03:03:04 -05:00
Matt Corallo
72a348fd9a Add addnode RPC command. 2013-01-27 03:03:04 -05:00
Jeff Garzik
fdbb537d26 Add new RPC "lockunspent", to prevent spending of selected outputs
and associated RPC "listlockunspent".

This is a memory-only filter, which is empty when a node restarts.
2012-11-15 21:11:30 -05:00
Gavin Andresen
34226be7a8 New createmultisig rpc command
This is to support the signrawtransaction API call; given the public
keys involved in a multisig transaction, this gives back the redeemScript
needed to sign it.
2012-10-29 13:34:35 -04:00
Pieter Wuille
beeb57610c Add gettxout and gettxoutsetinfo RPCs 2012-10-20 23:08:57 +02:00
Wladimir J. van der Laan
285746d3db Add constants for HTTP status codes 2012-10-04 15:49:15 +02:00
Wladimir J. van der Laan
738835d7b8 Document RPC error codes
Replace all "magic values" in RPCError(...) by constants.
2012-10-04 15:49:15 +02:00
coderrr
22dfd73598 Add address groupings RPC from the coincontrol patches.
Signed-off-by: Gregory Maxwell <greg@xiph.org>
2012-08-23 15:55:42 -04:00
Jeff Garzik
1954d40691 Merge pull request #1493 from jgarzik/unlocked-rpc
RPC: add facility to enable RPCs to run outside cs_main, wallet locks
2012-08-21 09:22:13 -07:00
Jeff Garzik
0e1d3551da RPC: add facility to enable RPCs to run outside cs_main, wallet locks
Use with 'stop' and 'help' RPCs.

This provides a facility to individually evaluate the locking for an RPC, and
potentially make it more parallel.
2012-08-21 12:03:52 -04:00
Gavin Andresen
b4b7ed1915 Fix 32-bit build error: include util.h to get int64 typedef 2012-08-21 11:59:59 -04:00
Jeff Garzik
5f2b41d54d Merge pull request #1693 from jgarzik/rpcwallet
Move code to new modules rpcwallet.cpp, rpcblockchain.cpp
2012-08-21 08:44:21 -07:00
Jeff Garzik
c625ae04d2 RPC, cosmetic: move more RPC code to new rpcblockchain.cpp module 2012-08-21 11:03:38 -04:00
Jeff Garzik
e3bc569865 RPC, cosmetic: move wallet-related RPCs to new rpcwallet.cpp module 2012-08-21 10:38:57 -04:00
Gavin Andresen
cc6dfd1f4b Allow signrawtransaction '...' null null 'hashtype'
Allows the user to pass null as the second or third parameter
to signrawtransaction, in case you need to (for example) fetch
private keys from the wallet but want to specify the hash type.
2012-08-20 17:19:13 -04:00
Gavin Andresen
899d373b3c RPCTypeCheck method to make type-checking JSON Arrays easier. 2012-07-05 12:42:25 -04:00
Jeff Garzik
480d44bd0b rpcdump: include cleanup. move JSONRPCError def to bitcoinrpc.h. 2012-05-23 23:20:07 -04:00
Jeff Garzik
7b671f52e0 Define BOOST_SPIRIT_THREADSAFE in all makefiles
rather than at each include site.

Fixes #1371
2012-05-21 22:25:54 -04:00
Fordy
3a25a2b9b0 Update License in File Headers
I originally created a pull to replace the "COPYING" in crypter.cpp and
crypter.h, but it turned out that COPYING was actually the correct
file.
2012-05-18 22:02:28 +08:00
David Joel Schwartz
e9205293bd Support multi-threaded JSON-RPC
Change internal HTTP JSON-RPC server from single-threaded to
thread-per-connection model.  The IP filter list is applied prior to starting
the thread, which then processes the RPC.

A mutex covers the entire RPC operation, because not all RPC operations are
thread-safe.

[minor modifications by jgarzik, to make change upstream-ready]
2012-05-08 20:11:17 -04:00
Wladimir J. van der Laan
460c51fdad Add UI RPC console / debug window 2012-05-05 10:37:06 +02:00
Pieter Wuille
e46704dd90 Expose CRPCTable via bitcoinrpc.h for testing 2012-04-21 01:37:34 +02:00
Gavin Andresen
882164196e Update all copyrights to 2012 2012-02-07 11:28:30 -05:00
Wladimir J. van der Laan
b90c9ecb13 Merge branch 'master' of https://github.com/bitcoin/bitcoin 2011-08-16 10:28:24 +02:00
Wladimir J. van der Laan
8fe2308b34 windows build fixes 2011-07-03 22:29:26 +02:00
Renamed from src/rpc.h (Browse further)