Commit Graph

206 Commits

Author SHA1 Message Date
Wladimir J. van der Laan e88f8887b6 Merge pull request #1977 from Diapolo/rem_printf_redef_rpc
remove printf redefinition from bitcoinrpc.cpp
2012-11-10 03:47:11 -08:00
Jeff Garzik 8146591a53 Merge branch 'http-improvements'
The base bits of pull req #1982.
2012-11-09 17:34:25 -05:00
Jeff Garzik fcf234fc08 RPC: HTTP server uses its own ReadHTTPRequestLine()
rather than reusing ReadHTTPStatus() from the client mode.

The following additional HTTP request validations are added, both in line with
existing HTTP client practice:

1) HTTP method must be GET or POST.  Most clients use POST, some
   use GET.  Either way, this continues to work.
2) HTTP URI must start with "/" character.
   Normal URI is "/" (a 1-char string), so this is fine.
2012-11-04 17:16:46 -05:00
Jeff Garzik 2306dc4b76 RPC, cosmetic: push down ReadHTTPStatus() calls into ReadHTTP() callers
ReadHTTPStatus() is currently overloaded:  In client mode, it properly parses
and receives an HTTP status line.  In server mode, it incorrectly parses the
HTTP request line as an HTTP status line.

This server mode bug has never mattered, because the RPC server never
cared about the URI (path) provided in the HTTP request.  That will change in
the future, so go ahead and begin fixing the problem.

This patch is cosmetic, and should result in NO behavior changes.

Further renames:
ReadHTTPHeader -> ReadHTTPHeaders
ReadHTTP -> ReadHTTPMessage
2012-11-04 16:06:38 -05:00
Pieter Wuille 92467073ad Remove -detachdb and stop's detach argument.
As the only BDB database left is the wallet, and it is always
detached.

Also remove IsChainFile() predicate and related chainfile-specific
logic.
2012-11-04 12:59:06 +01:00
Philip Kaufmann ed552cfae0 remove printf redefinition from bitcoinrpc.cpp
- as the redefiniton of printf happens in util.h, which is included in
  bitcoinrpc.cpp, we don't need another redefinition
2012-11-04 11:24:54 +01: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
Philip Kaufmann 95e625d235 fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cpp
- also includes the required bitcoinstrings.cpp update
2012-10-05 23:31:58 +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
Philip Kaufmann d210f4f5b8 fix -Wformat warnings all over the source 2012-10-01 19:45:42 +02:00
Pieter Wuille 2e3ffb2d82 Remove stack randomization 2012-09-28 21:53:28 +02:00
Pieter Wuille 842a31ad1b Merge pull request #1862 from kjj2/testports
Fix: when testnet=1 specified, change default RPC port to 18332
2012-09-28 08:03:45 -07:00
kjj2 b202d43076 Fix: when testnet=1 specified, change default ports to 18332 and 18333 2012-09-24 15:26:04 -05:00
Wladimir J. van der Laan feec18e329 Merge pull request #1836 from kjj2/stopdetach
Adds a stopdetach <detach> RPC command.  <detach> defaults to true.  Wor...
2012-09-23 05:49:42 -07:00
kjj2 3731f5788e Adds a stopdetach <detach> RPC command. <detach> defaults to true. Works just like stop, but overrides the commandline/config file
-detachdb option.  Useful for upgrading, for example.  Lets you use fast stops usually, but force a detach when needed.  Also, allows
you to do a fast stop in a system normally configured for fast stops.
2012-09-22 18:17:29 -05:00
Wladimir J. van der Laan e96a8c7d86 Merge pull request #1793 from Diapolo/fix_signed_unsigned_strprintf
fix signed/unsigned in strprintf and CNetAddr::GetByte()
2012-09-21 06:04:27 -07:00
Jeff Garzik ea0796bde3 Trim trailing whitespace for src/*.{h,cpp} 2012-09-18 15:07:58 -04:00
Philip Kaufmann 463a1cab43 fix signed/unsigned in strprintf and CNetAddr::GetByte()
- I checked every occurance of strprintf() in the code and used %u, where
  unsigned vars are used
- the change to GetByte() was made, as ip is an unsigned char
2012-09-12 21:30:47 +02:00
Pieter Wuille c1d79812f4 Do not abort if RPC listening for IPv6 fails
Instead, fall back to IPv4 listening.
2012-09-12 16:45:09 +02:00
Wladimir J. van der Laan 4d1d94c56c Rename CreateThread to NewThread
Prevent clash with win32 API symbol
2012-08-29 20:25:37 +02:00
Gregory Maxwell c68c4bc7a4 Merge pull request #1672 from gmaxwell/filter_listunspent
Listunspent txout address filtering and listaddressgroupings
2012-08-24 00:46:24 -07:00
Gregory Maxwell bdab0cf58c Avoid leaving return types or function attributes on their own lines. 2012-08-24 02:48:19 -04:00
Gregory Maxwell 92735bca31 Add txout address filtering to listunspent.
This applies on top of the coincontrol listaddressgroupings patch
and makes finding eligible outputs from the groups returned
by listaddressgroupings possible.
2012-08-23 15:55:50 -04: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 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
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
Gregory Maxwell 4a4a0c1196 Merge pull request #1690 from gavinandresen/signrawtx_null
Allow signrawtransaction '...' null null 'hashtype'
2012-08-21 06:40:50 -07:00
Jeff Garzik 7600e7fc39 RPC, cosmetic: Create rpcmining.cpp as new home for mining-related RPC code 2012-08-21 02:21:33 -04:00
Jeff Garzik ddd1ffb4f1 RPC, cosmetic: de-indent getblocktemplate() 2012-08-21 02:06:09 -04:00
Jeff Garzik 79f2525ab6 RPC: split new 'submitblock' out of 'getblocktemplate' 2012-08-21 02:02:06 -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
Luke Dashjr 44427fa833 Merge branch 'gmp_bip_0.6.0' into gmp_bip
Conflicts:
	src/bitcoinrpc.cpp
2012-08-03 01:12:55 +00:00
Luke Dashjr 3390014fd0 Minimal BIP 22 (getblocktemplate) support
- Replaces getmemorypool with new getblocktemplate
- Add missing keys: coinbaseaux, target, mutable, noncerange, sigoplimit, sizelimit, and height
- Accept and send parameter Objects, checking "mode" key if present
- Return rejection reason "rejected" for submit mode
2012-08-03 01:02:51 +00:00
Gregory Maxwell 8ce7915aad Merge pull request #1612 from luke-jr/opti_getblkhash
Optimize JSON-RPC getblockhash
2012-08-01 11:49:26 -07:00
Luke Dashjr 1be064190e Optimize JSON-RPC getblockhash
- If the height is in the first half, start at the genesis block and go up, rather than at the top
- Cache the last lookup and use it as a reference point if it's close to the next request, to make linear lookups always fast
2012-08-01 18:23:30 +00:00
Luke Dashjr 814efd6f1f Bugfix: Fix a variety of misspellings 2012-08-01 17:49:51 +00:00
Gavin Andresen 986a78979e Merge branch 'bugfix_CNBerr' of git://github.com/luke-jr/bitcoin 2012-07-26 13:55:21 -04:00
Gavin Andresen 18871d4785 Give a better error message than 'type mismatch' for complex JSON arguments 2012-07-17 12:02:31 -04:00
Giel van Schijndel 9f46ab62b1 Fix thread names after review
* Fix wrong thread name for wallet *relocking* thread
  - Was named the unlocking thread
 * Use consistent naming

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-07-17 01:50:35 +02:00
Giel van Schijndel 96931d6f78 Give threads a recognisable name to aid in debugging
NOTE: These thread names are visible in gdb when using 'info threads'.
      Additionally both 'top' and 'ps' show these names *unless* told to
      display the command-line instead of task name.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-07-17 01:50:35 +02:00
Jeff Garzik 698b9f3095 bitcoinrpc.cpp: Removed outdated comment
Fixes #1373
2012-07-05 18:18:15 -04:00
Gavin Andresen dab9fa7f91 Use unsigned ints to fix signed/unsigned warnings 2012-07-05 13:26:27 -04:00
Gavin Andresen a2709fad7f Implement raw transaction RPC calls
Implement listunspent / getrawtransaction / createrawtransaction /
signrawtransaction, to support creation and
signing-on-multiple-device multisignature transactions.
2012-07-05 12:50:09 -04:00
Gavin Andresen 899d373b3c RPCTypeCheck method to make type-checking JSON Arrays easier. 2012-07-05 12:42:25 -04:00
Gavin Andresen 9a6ab7f142 Rework gettransaction / getblock RPC calls
This PULL reworks new (post-0.6.*) features of the
gettransaction/getblock RPC calls as follows:

It removes the 'decompositions' object argument from getblock,
replacing it just a list of transaction hashes; equivalent
(I believe) of passing the {"tx":"hash"} decomposition.

It replaces the 'decompositions' object argument of
gettransaction with a boolean flag; if true, returns
the same stuff that the {"script":"obj"} decomposition
would return (txins/txouts as hex, disassembled, and bitcoin
addresses).

It adds a "rawtx" field to the output of gettransaction,
that is the entire transaction serialized and hex-encoded.

It removes the "size" field from gettransaction, since the size
is trivial to compute from the "rawtx" field (either take the
length after hex-decoding, or just compute it as hex-length/2).
2012-07-05 12:42:25 -04:00
Jeff Garzik 613389019e RPC: add support for JSON-RPC 2.0-style request batching
If the top-level object is an array, it is assumed to be an array of
JSON-RPC requests.  An array is returned, containing one response (error or
not) per request, in the order submitted.

In a slight change in semantics, batched requests -always- return
an HTTP 200 OK status, even ones full of invalid or incorrect requests.
2012-07-03 22:53:57 -04:00