Commit Graph

166 Commits

Author SHA1 Message Date
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
Jeff Garzik c6494d82fa RPC: break out high level JSON-RPC req/resp into their own functions
This prepares for JSON-RPC 2.0 batches.
2012-07-03 22:53:30 -04:00
Jeff Garzik 1006f0707e RPC: add 'getpeerinfo', returning easy-to-retrieve per-CNode data 2012-06-29 17:24:53 -04:00
Jeff Garzik 70ab73a008 Create new rpcnet module, and move 'getconnectioncount' RPC to it 2012-06-28 23:18:38 -04:00
Matt Corallo 460d878613 Fix build error. 2012-06-28 19:31:22 +02:00
Matt Corallo 4e97a9d9eb Lock vnThreadsRunning[THREAD_RPCHANDLER]. 2012-06-28 18:34:11 +02:00
Matt Corallo 7cf3d2ccb9 Use a rpc-specific queue to tell asio connections to shutdown. 2012-06-28 18:32:32 +02:00
Matt Corallo 18c4beb05b Revert "*Always* send a shutdown signal to enable custom shutdown actions"
This reverts commit 896899e0d6.
2012-06-28 15:52:45 +02:00
Giel van Schijndel ad25804feb Cancel outstanding listen ops for RPC when shutting down
Use Boost's signal2 slot tracking mechanism to cancel any (still open)
listening sockets when receiving a shutdown signal.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-06-24 15:12:15 +02:00
Giel van Schijndel 415a87ef36 Merge branch 'master' into async-ipv6-rpc 2012-06-24 12:34:15 +02:00
Jeff Garzik 25d5c19522 RPC: add 'getrawmempool', listing all transaction ids in memory pool 2012-06-22 11:43:34 -04:00
Giel van Schijndel 896899e0d6 *Always* send a shutdown signal to enable custom shutdown actions
NOTE: This is required to be sure that we can properly shut down the RPC
      thread.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-06-17 21:50:49 +02:00
Giel van Schijndel 07368a9e3c Merge branch 'master' into async-ipv6-rpc
Conflicts:
	src/bitcoinrpc.cpp

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-06-17 14:30:37 +02:00
Philip Kaufmann 9247134eab introduce a new StartShutdown() function, which starts a thread with Shutdown() if no GUI is used and calls uiInterface.QueueShutdown() if a GUI is used / all direct uiInterface.QueueShutdown() calls are replaced with Shutdown() - this ensures a clean GUI shutdown, even when catching a SIGTERM and allows the BitcoinGUI destructor to get called (which fixes a tray-icon issue and keeps the tray-icon until Bitcoin-Qt exits) 2012-06-12 07:21:03 +02:00
Gavin Andresen 46e06b875d Merge branch 'netopt' of https://github.com/sipa/bitcoin 2012-06-04 14:15:19 -04:00
Gavin Andresen 98474d3d6f Use ConvertTo to simplify sendmany/addmultisigaddress argument handling 2012-05-31 16:09:31 -04:00
Gavin Andresen ea7582bb41 Make sendrawtx return txid to be consistent with other send methods. 2012-05-31 16:05:07 -04:00
Pieter Wuille 587f929c64 Rework network config settings 2012-05-31 18:12:35 +02:00
Giel van Schijndel fbf9df2ea3 Use the QueueShutdown signal to stop accepting new RPC connections
Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-05-25 07:27:25 +02:00
Giel van Schijndel 7cc2ceae09 Allow all addresses on the loopback subnet (127.0.0.0/8) not just 127.0.0.1
Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-05-25 07:27:24 +02:00
Giel van Schijndel a0780ba08a Generalise RPC connection handling code to allow more listening sockets
Using this modification it should be relatively easy to, at a later
time, listen on multiple addresses (even Unix domain sockets should be
possible).

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-05-25 07:27:24 +02:00
Giel van Schijndel 43b6dafa6e Allow clients on the IPv6 loopback as well
Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-05-25 07:27:24 +02:00
Giel van Schijndel c1ecab818c Add dual IPv4/IPv6 stack support to the RPC server
The RPC server now listens for, and handles, incoming connections on
both IPv4 as well as IPv6.

If available (and usable) it uses a dual IPv4/IPv6 socket on systems
that support it (e.g. Linux and BSDs) and falls back to separate
IPv4/IPv6 sockets on systems that don't (e.g. Windows).

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-05-25 07:27:24 +02:00
Giel van Schijndel 914dc01222 Use asynchronous I/O to handle RPC requests
This allows more flexibility in the RPC code, e.g. making it easier to
handle multiple simultaneous connections later on.

Currently asynchronous I/O is only used to listen for and accept
incoming connections.  Asynchronous reading/writing is more involved.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-05-25 07:27:24 +02:00
Pieter Wuille 1025440184 Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
This introduces internal types:
* CKeyID: reference (hash160) of a key
* CScriptID: reference (hash160) of a script
* CTxDestination: a boost::variant of the former two

CBitcoinAddress is retrofitted to be a Base58 encoding of a
CTxDestination. This allows all internal code to only use the
internal types, and only have RPC and GUI depend on the base58 code.

Furthermore, the header dependencies are a lot saner now. base58.h is
at the top (right below rpc and gui) instead of at the bottom. For the
rest: wallet -> script -> keystore -> key. Only keystore still requires
a forward declaration of CScript. Solving that would require splitting
script into two layers.
2012-05-24 20:26:19 +02:00
Pieter Wuille fd61d6f506 Encapsulate public keys in CPubKey 2012-05-24 19:58:12 +02:00
Jeff Garzik 976c08b68a JSON-RPC: Add 'sendrawtx' op, for sending pre-built TX's to network 2012-05-23 16:21:25 -04:00
Pieter Wuille 46784d0826 Merge pull request #1354 from fanquake/master
Update Header Licenses
2012-05-20 12:27:50 -07:00
Wladimir J. van der Laan 239c11d0dd Make testcases build, prevent windows symbol collision 2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan ab1b288fa7 Convert UI interface to boost::signals2.
- Signals now go directly from the core to WalletModel/ClientModel.
  - WalletModel subscribes to signals on CWallet: Prepares for multi-wallet support, by no longer assuming an implicit global wallet.
- Gets rid of noui.cpp, the few lines that were left are merged into init.cpp
- Rename wxXXX message flags to MF_XXX, to make them UI indifferent.
- ThreadSafeMessageBox no longer returns the value `4` which was never used, converted to void.
2012-05-20 10:44:50 +02:00
Pieter Wuille bd795bd543 Merge pull request #1358 from luke-jr/shared_lockchk
Shared code for wallet lock help and check
2012-05-19 08:34:27 -07:00
Luke Dashjr 29875dcb4b Shared code for wallet lock help and check 2012-05-18 23:13:21 +00:00
Philip Kaufmann ff0ee876bb change strings to Bitcoin (uppercase), where it is used as a noun and update strings to use "Qt" (and not qt or QT) / update initialisation of notificator to use qApp->applicationName() instead of a static string 2012-05-18 23:13:58 +02: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
Jeff Garzik 47f48a658d JSON-RPC: remove 'getblocknumber' deprecated RPC
RPC 'getblockcount' should be used instead.
2012-05-17 23:43:00 -04:00
Jeff Garzik 7563424f32 Merge pull request #1334 from rebroad/Exiting2Exited
Corrected grammar. As per Principle Of Least Surprise.
2012-05-17 11:29:09 -07:00
R E Broadley 1d764d631f Corrected grammar. As per Principle Of Least Surprise. 2012-05-17 18:52:38 +01:00
Jeff Garzik 0fb78eae34 Always check return values of TxnBegin() and TxnCommit() 2012-05-14 01:11:11 -04:00
Pieter Wuille 22db3f2c77 Fix warning about uninitialized value
Only reported when using -flto.
2012-05-13 01:36:46 +02:00
Philip Kaufmann bc05562730 convert 4 tabs into 4 x 4 spaces in bitcoinrpc.cpp 2012-05-12 11:06:30 +02:00
Jeff Garzik b34c5f3c0f Merge pull request #1101 from jgarzik/http11
Multithreaded JSON-RPC with HTTP 1.1 Keep-Alive support
2012-05-11 09:57:08 -07:00