Commit graph

267 commits

Author SHA1 Message Date
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
Pieter Wuille 722fa283d0 Break dependency of init on wallet.
This required some code movement (what was CWalletTx::AcceptToMemoryPool
doing in main?), and adding a few explicit includes that used to be
implicit through init.h.
2013-10-26 14:51:47 +02:00
Jeff Garzik 406b1f05f6 Revert "JSON Spirit updated to v4.06"
This reverts commit 2227389fa8.
2013-10-22 05:43:46 -04:00
Jeff Garzik 0db9a805bd Revert "Switch to using raw_utf8"
This reverts commit 2ecb7555a9.
2013-10-22 05:43:38 -04:00
Gavin Andresen 125bdead3e Merge pull request #2740 from constantined/constantined
UTF-8 support for JSON-RPC
2013-10-22 01:20:02 -07:00
Gavin Andresen cc7562b7d2 Merge pull request #3104 from Diapolo/rpcssl-defaultciphers
update default -rpcsslciphers to include TLSv1.2
2013-10-20 19:50:11 -07: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
Philip Kaufmann 1728bf0873 update default -rpcsslciphers to include TLSv1.2
- this extends the accepted ciphersuites with TLSv1.2 ones
- also removes !AH, as I could not find documentation on it and the change
  did not result in a changed ciphersuite list (checked via openssl
  ciphers -v)
- closes #3096 (which also contains more details)
2013-10-17 16:11:25 +02:00
Wladimir J. van der Laan f0c25cf6ec Merge pull request #2924 from sje397/TrafficGraph
[QT] Add network traffic graph to debug window
2013-10-15 03:48:22 -07:00
Gavin Andresen b2ba55c42b Avoid core dump if rpc port is in use.
The cleanup code needs to check for NULL rpcworkers thread group.
2013-10-15 15:30:20 +10: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
Philip Kaufmann f65dddc7b2 misc small spelling/indentation fixes 2013-10-01 09:47:16 +02:00
Gavin Andresen ff4e3e63e7 Merge pull request #2949 from gmaxwell/fewer_fee_footguns
[raw] reject insanely high fees by default in sendrawtransaction
2013-09-22 16:44:35 -07:00
Gavin Andresen 881a85a22d Replace printf with LogPrintf / LogPrint 2013-09-18 20:39:25 +10: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
Gregory Maxwell 9d14e689c8 [raw] reject insanely high fees by default in sendrawtransaction
There have been several incidents where mainnet experimentation with
 raw transactions  resulted in insane fees.  This is hard to prevent
 in the raw transaction api because the inputs may not be known.
 Since sending doesn't work if the inputs aren't known, we can catch
 it there.

This rejects fees > than 10000 * nMinRelayTxFee or 1 BTC with the
 defaults and can be overridden with a bool at the rpc.
2013-08-28 15:49:51 -07:00
Jeff Garzik e5e9904c1c RPC: add getrawchangeaddress, for raw transaction change destinations 2013-08-28 16:29:52 -04:00
Gavin Andresen a0bb001431 Merge pull request #2886 from gavinandresen/rpctiming
Make RPC password resistant to timing attacks
2013-08-15 18:53:26 -07:00
Gavin Andresen 4323bfeafd Merge pull request #2776 from jgarzik/keypoolsize
RPC: keypoolrefill now permits optional size parameter, to bump keypool
2013-08-14 22:01:22 -07:00
Gavin Andresen 42656ea2e5 Make RPC password resistant to timing attacks
Fixes issue#2838; this is a tweaked version of pull#2845 that
should not leak the length of the password and is more generic,
in case we run into other situations where we need
timing-attack-resistant comparisons.
2013-08-08 19:58:57 +10:00
Gavin Andresen 050d2e953f Remove #define loop from util.h
Replace the loop macro with while (true). The #define caused
problems for Qt.
2013-07-31 14:06:44 +10:00
constantined 2ecb7555a9 Switch to using raw_utf8 2013-07-23 04:51:29 +03:00
constantined 2227389fa8 JSON Spirit updated to v4.06 2013-07-23 04:48:14 +03:00
Jeff Garzik 091aa8dae9 RPC: add getbestblockhash, to return tip of best chain 2013-07-03 11:02:29 -04:00
Jeff Garzik 36bd46f1c4 RPC: keypoolrefill gains optional size parameter 2013-06-25 16:21:42 -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
Jeff Garzik 4be2aba302 Merge pull request #2778 from jgarzik/rpc-verifydb
RPC: add 'verifychain' to verify chain database at runtime
2013-06-22 23:08:13 -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
Mike Hearn 0e4b317555 Introduce a CChainParameters singleton class and regtest mode.
The new class is accessed via the Params() method and holds
most things that vary between main, test and regtest networks.
The regtest mode has two purposes, one is to run the
bitcoind/bitcoinj comparison tool which compares two separate
implementations of the Bitcoin protocol looking for divergence.

The other is that when run, you get a local node which can mine
a single block instantly, which is highly convenient for testing
apps during development as there's no need to wait 10 minutes for
a block on the testnet.
2013-06-19 16:28:52 +02:00
Jeff Garzik 543d70a676 Merge pull request #2747 from luke-jr/getblock_verbose0
Add verbose flag to getblock RPC so it is possible to get hex dumps of blocks
2013-06-10 08:16:39 -07:00
Luke Dashjr 2331952141 RPC: getblock(): Accept 2nd "verbose" parameter, similar to getrawtransaction, but defaulting to 1 for backward compatibility 2013-06-07 17:44:39 +00:00
Philip Kaufmann 3260b4c090 remove GetBoolArg() fDefault parameter defaulting to false
- explicitly set the default of all GetBoolArg() calls
- rework getarg_test.cpp and util_tests.cpp to cover this change
- some indentation fixes
- move macdockiconhandler.h include in bitcoin.cpp to the "our headers"
  section
2013-06-01 12:53:57 +02: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
Jeff Garzik 9f4976afe2 RPC: strictly require HTTP URI "/"
Previously, JSON-RPC clients accessed URI "/", and the JSON-RPC server
did not care about the URI at all, and would accept any URI as valid.

Change the JSON-RPC server to require URI "/" for all current accesses.

This changes enables the addition of future interfaces at different
URIs, such as pull request #1982 which demonstrates HTTP REST wallet
download.

Or, a future, breaking change in JSON-RPC interface could be introduced
by serving JSON-RPC calls from new URI "/v2/".
2013-05-01 10:41:24 -04:00
Gavin Andresen b31499ec72 Clean up shutdown process 2013-04-03 19:57:53 -04:00
Gavin Andresen 21eb5adadb Port Thread* methods to boost::thread_group 2013-04-03 19:57:13 -04:00
Gavin Andresen 1b43bf0d3a Rename util.h Sleep --> MilliSleep
Two reasons for this change:
1. Need to always use boost::thread's sleep, even on Windows, so the
sleeps can be interrupted (prior code used Windows' built-in Sleep).

2. I always forgot what units the old Sleep took.
2013-04-03 14:04:21 -04:00
Philip Kaufmann 90bd933e6d translation base files update 2013-04-02
- also includes a small change to a string in bitcoinrpc.cpp, which is not
  on Transifex anyway, so is safe to merge
2013-04-02 15:46:40 +02:00
Gavin Andresen 3d9d2d423b Recommend alertnotify 2013-03-21 10:08:21 -04:00