Commit graph

5979 commits

Author SHA1 Message Date
Pieter Wuille d422f9b1fd Test whether created sockets are select()able 2015-07-10 12:05:09 -04:00
Wladimir J. van der Laan fac21df5f0
Merge pull request #6370
6ebac07 Remove ChainParams::DefaultMinerThreads (Wladimir J. van der Laan)
2015-07-10 17:12:40 +02:00
Wladimir J. van der Laan c52e8b300a
Merge pull request #6379
9cc9152 rpc: Accept scientific notation for monetary amounts in JSON (Wladimir J. van der Laan)
2015-07-10 16:50:46 +02:00
Pieter Wuille 5098c47b24 Implement accurate memory accounting for mempool 2015-07-10 10:49:31 -04:00
Wladimir J. van der Laan 9cc91523db rpc: Accept scientific notation for monetary amounts in JSON
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-10 15:43:26 +02:00
Wladimir J. van der Laan 943b322d5d
Merge pull request #5486
c45c7ea [REST] add JSON support for /rest/headers/ (Jonas Schnelli)
2015-07-10 15:25:51 +02:00
Wladimir J. van der Laan 445220544e
Merge pull request #5288
e3cae52 Added -whiteconnections=<n> option (Josh Lehan)
2015-07-10 15:07:15 +02:00
Wladimir J. van der Laan 85ee55b5c3 rpc: Remove chain-specific RequireRPCPassword
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-10 15:01:55 +02:00
Wladimir J. van der Laan 708037fcc7
Merge pull request #6384
15e26a6 qt: Force TLS1.0+ for SSL connections (Wladimir J. van der Laan)
2015-07-10 15:00:01 +02:00
Wladimir J. van der Laan 7fc25c2e5d
Merge pull request #6368
cb54d17 CLTV: Add more tests to improve coverage (Esteban Ordano)
2015-07-09 11:20:17 +02:00
Wladimir J. van der Laan aa565327ec
Merge pull request #6378
5e058e7 [Qt] constify foreach uses where possible (Philip Kaufmann)
2015-07-09 10:54:21 +02:00
Wladimir J. van der Laan 11576a57d2
Merge pull request #6387
65ce021 [bitcoin-cli] improve error output (Jonas Schnelli)
2015-07-08 13:39:57 +02:00
Wladimir J. van der Laan 133601f6a5 tests: Fix bitcoin-tx signing testcase
Fixes wrong scriptPubkey problem, which caused the transaction to
not actually be signed.
2015-07-07 18:26:38 +02:00
Jonas Schnelli 65ce0215a4 [bitcoin-cli] improve error output 2015-07-07 17:25:56 +02:00
Philip Kaufmann 5e058e7417 [Qt] constify foreach uses where possible
- this doesn't replace BOOST_FOREACH, it just makes used arguments const
  where possible
2015-07-07 06:53:43 +02:00
Adam Weiss 27d7605804 Buffer log messages and explicitly open logs
Prevents stomping on debug logs in datadirs that are locked by other
instances and lost parameter interaction messages that can get wiped by
ShrinkDebugFile().

The log is now opened explicitly and all emitted messages are buffered
until this open occurs.  The version message and log cut have also been
moved to the earliest possible sensible location.
2015-07-06 21:54:31 -04:00
Esteban Ordano cb54d17355 CLTV: Add more tests to improve coverage
Four cases included:

* The CLTV operand type mismatches the tx locktime. In the script it is
  1 (interpreted as block height), but in the tx is 500000000
  (interpreted as date)
* The stack is empty when executing OP_CLTV
* The tx is final by having only one input with MAX_INT sequence number
* The operand for CLTV is negative (after OP_0 OP_1 OP_SUB)
2015-07-06 13:09:37 -07:00
Wladimir J. van der Laan 15e26a6a9a qt: Force TLS1.0+ for SSL connections 2015-07-06 20:06:16 +02:00
Wladimir J. van der Laan 086cb336cd
Merge pull request #6365
5a7304b Move recently introduced CTransAction::IsEquivalentTo to CWalletTx (Wladimir J. van der Laan)
2015-07-06 19:11:14 +02:00
Wladimir J. van der Laan 9546a977d3
Merge pull request #6335
9238ecb Policy: MOVEONLY: 3 functions to policy.o: (Luke Dashjr)
627b9de Policy: MOVEONLY: Create policy/policy.h with some constants (Jorge Timón)
2015-07-06 18:54:20 +02:00
Jonas Schnelli c45c7ea0fa [REST] add JSON support for /rest/headers/ 2015-07-05 15:48:33 +02:00
Wladimir J. van der Laan 6ebac0782f Remove ChainParams::DefaultMinerThreads
No longer relevant after #5957. This hack existed because of another
hack where the numthreads parameter, on regtest, doubled as how many
blocks to generate.
2015-07-03 16:46:20 +02:00
Wladimir J. van der Laan d0a10c1959
Merge pull request #6329
0c37634 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only (Luke Dashjr)
2015-07-03 14:00:06 +02:00
Luke Dashjr 0c376340a4 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only 2015-07-03 08:29:16 +00:00
Wladimir J. van der Laan 5a7304b69d Move recently introduced CTransAction::IsEquivalentTo to CWalletTx
CTransAction::IsEquivalentTo was introduced in #5881.
This functionality is only useful to the wallet, and should never have
been added to the primitive transaction type.
2015-07-02 20:57:39 +02:00
Jonas Schnelli 177a0e4914 Adding CSubNet constructor over a single CNetAddr 2015-07-02 20:44:27 +02:00
Jonas Schnelli 409bccfbf5 use CBanEntry as object container for banned nodes
- added a reason enum for a ban
- added creation time for a ban

Using CBanEntry as container will keep banlist.dat extenable.
2015-07-02 20:29:36 +02:00
Jonas Schnelli dfa174c295 CAddrDB/CBanDB: change filesize variables from int to uint64_t 2015-07-02 20:29:36 +02:00
Jonas Schnelli f581d3d656 banlist.dat: store banlist on disk 2015-07-02 20:29:36 +02:00
Wladimir J. van der Laan d6db1157bc
Merge pull request #6362
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-02 20:09:28 +02:00
Wladimir J. van der Laan d7ada03b8a
Merge pull request #6361
4716267 Use real number of cores for default -par, ignore virtual cores (Wladimir J. van der Laan)
2015-07-02 20:01:04 +02:00
Wladimir J. van der Laan 3203a0832a
Merge pull request #5881
5d34e16 Add txn_clone.py test (Tom Harding)
defd2d5 Better txn_doublespend.py test (Tom Harding)
b2b3619 Implement CTransaction::IsEquivalentTo(...) (Tom Harding)
2015-07-02 19:59:50 +02:00
Wladimir J. van der Laan 987efae1fd
Merge pull request #6133
e617fe2 Fix various warnings (Luke Dashjr)
2015-07-02 19:54:12 +02:00
Wladimir J. van der Laan 726e28643c
Merge pull request #6247
076badb Add getblockheader RPC call (Peter Todd)
2015-07-02 18:53:18 +02:00
Forrest Voight 72b9452b1d 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.

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-07-01 21:55:08 -04:00
Wladimir J. van der Laan 6bcb0a21c5
Merge pull request #6353
5ed1079 Show softfork status in getblockchaininfo (Wladimir J. van der Laan)
2015-07-01 19:37:24 +02:00
Wladimir J. van der Laan 5ed10793c2 Show softfork status in getblockchaininfo 2015-07-01 19:36:17 +02:00
Wladimir J. van der Laan 47162673c7 Use real number of cores for default -par, ignore virtual cores
To determine the default for `-par`, the number of script verification
threads, use [boost:🧵:physical_concurrency()](http://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_management.html#thread.thread_management.thread.physical_concurrency)
which counts only physical cores, not virtual cores.

Virtual cores are roughly a set of cached registers to avoid context
switches while threading, they cannot actually perform work, so spawning
a verification thread for them could even reduce efficiency and will put
undue load on the system.

Should fix issue #6358, as well as some other reported system overload
issues, especially on Intel processors.

The function was only introduced in boost 1.56, so provide a utility
function `GetNumCores` to fall back for older Boost versions.
2015-07-01 18:01:16 +02:00
Jonas Schnelli a7b9623d18 miner: rename UpdateRequestCount signal to ResetRequestCount 2015-07-01 16:09:58 +02:00
Jonas Schnelli 5496253966 add CReserveScript to allow modular script keeping/returning
- use one CReserveScript per mining thread
2015-07-01 16:06:14 +02:00
Jonas Schnelli 087e65def9 fix GetScriptForMining() CReserveKey::keepKey() issue 2015-06-30 21:45:46 +02:00
Jonas Schnelli d0fc10a844 detach wallet from miner 2015-06-30 21:45:46 +02:00
Suhas Daftuar 6b1066fab4 Ignore whitelisting during IBD for unrequested blocks. 2015-06-30 09:42:56 -04:00
Wladimir J. van der Laan 0564c5b795
Merge pull request #6337
6a4b97e Testing infrastructure: mocktime fixes (Gavin Andresen)
2015-06-29 16:41:29 +02:00
Luke Dashjr 9238ecb417 Policy: MOVEONLY: 3 functions to policy.o:
- [script/standard.o] IsStandard
- [main.o] IsStandardTx
- [main.o] AreInputsStandard

Also, don't use namespace std in policy.cpp
2015-06-26 17:59:10 +02:00
Jorge Timón 627b9deff4 Policy: MOVEONLY: Create policy/policy.h with some constants 2015-06-26 17:59:07 +02:00
Wladimir J. van der Laan 24f24896d6
Merge pull request #6299
4f40716 test: Move reindex test to standard tests (Wladimir J. van der Laan)
36c97b4 Bugfix: Don't check the genesis block header before accepting it (Jorge Timón)
2015-06-26 15:40:59 +02:00
Wladimir J. van der Laan 41076aad0c
Merge pull request #6124
ffd75ad Enable CHECKLOCKTIMEVERIFY as a standard script verify flag (Peter Todd)
bc60b2b Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65) (Peter Todd)
48e9c57 Move LOCKTIME_THRESHOLD to src/script/script.h (Peter Todd)
99088d6 Make CScriptNum() take nMaxNumSize as an argument (Peter Todd)
2015-06-26 14:42:45 +02:00
Wladimir J. van der Laan 5aa34c7944
Merge pull request #6333
b932953 Hardcoded seeds update June 2015 (Wladimir J. van der Laan)
884454a contrib: Add port parsing to makeseeds.py (Wladimir J. van der Laan)
ccd4369 contrib: Improvements to hardcoded seeds scripts (Wladimir J. van der Laan)
2015-06-25 17:07:00 +02:00
Wladimir J. van der Laan e34a8acd9f
Merge pull request #6233
3e91433 Advance pindexLastCommonBlock for blocks in chainActive (Suhas Daftuar)
2015-06-25 16:36:23 +02:00
Jonas Schnelli 77aeb7c964 UniValue: don't escape solidus, keep espacing of reverse solidus 2015-06-25 08:10:08 +02:00
Wladimir J. van der Laan b9329536cd Hardcoded seeds update June 2015 2015-06-25 08:05:52 +02:00
Gavin Andresen 6a4b97e863
Testing infrastructure: mocktime fixes
New, undocumented-on-purpose -mocktime=timestamp command-line
argument to startup with mocktime set. Needed because
time-related blockchain sanity checks are done on startup, before a
test has a chance to make a setmocktime RPC call.

And changed the setmocktime RPC call so calling it will not result in
currently connected peers being disconnected due to inactivity timeouts.
2015-06-24 15:18:55 -04:00
Wladimir J. van der Laan 91389e51c7
Merge pull request #6088
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-23 12:40:00 +02:00
Luke Dashjr e617fe2578 Fix various warnings
Found while building on Debian 7
2015-06-23 08:39:57 +00:00
Peter Todd ffd75adce0
Enable CHECKLOCKTIMEVERIFY as a standard script verify flag
Transactions that fail CLTV verification will be rejected from the
mempool, making it easy to test the feature. However blocks containing
"invalid" CLTV-using transactions will still be accepted; this is *not*
the soft-fork required to actually enable CLTV for production use.
2015-06-22 00:00:48 -04:00
Peter Todd bc60b2b4b4 Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65)
<nLockTime> CHECKLOCKTIMEVERIFY -> <nLockTime>

Fails if tx.nLockTime < nLockTime, allowing the funds in a txout to be
locked until some block height or block time in the future is reached.

Only the logic and unittests are implemented; this commit does not have
any actual soft-fork logic in it.

Thanks to Pieter Wuille for rebase.

Credit goes to Gregory Maxwell for the suggestion of comparing the
argument against the transaction nLockTime rather than the current
time/blockheight directly.
2015-06-21 23:56:28 -04:00
Wladimir J. van der Laan b6668209aa build: Remove -DBOOST_SPIRIT_THREADSAFE
Now that boost spirit is no longer used, `-DBOOST_SPIRIT_THREADSAFE`
doesn't need to be passed to the compiler anymore.
2015-06-21 14:09:34 +02:00
Jorge Timón 36c97b4e5d Bugfix: Don't check the genesis block header before accepting it
This fixes an error triggered when running with -reindex after #5975
2015-06-21 01:24:51 +02:00
Wladimir J. van der Laan 247b91449a
Merge pull request #6262
506bae3 Return all available information via validateaddress (dexX7)
2015-06-19 18:30:58 +02:00
Wladimir J. van der Laan 57539884f2
Merge pull request #6290
57092ed rpc: make `gettxoutsettinfo` run lock-free (Wladimir J. van der Laan)
2015-06-19 17:42:50 +02:00
Jonas Schnelli 1c043d5672 fix lock issue for QT node diconnect and RPC disconnectnode 2015-06-19 16:32:22 +02:00
Jonas Schnelli 932687bc10 setban: add IPv6 tests 2015-06-19 13:51:42 +02:00
Jonas Schnelli 62909f68a0 fix missing lock in CNode::ClearBanned() 2015-06-19 13:31:33 +02:00
Wladimir J. van der Laan 40400d53d3
Merge pull request #6272
edbdf88 tests: Extend RPC proxy tests (Wladimir J. van der Laan)
baf0507 Improve proxy initialization (Wladimir J. van der Laan)
2015-06-18 17:53:36 +02:00
Wladimir J. van der Laan 0abfa8a22f
Merge pull request #6158
9d79afe add RPC tests for setban & disconnectnode (Jonas Schnelli)
1f02b80 setban: add RPCErrorCode (Jonas Schnelli)
d624167 fix CSubNet comparison operator (Jonas Schnelli)
4e36e9b setban: rewrite to UniValue, allow absolute bantime (Jonas Schnelli)
3de24d7 rename json field "bannedtill" to "banned_until" (Jonas Schnelli)
433fb1a [RPC] extend setban to allow subnets (Jonas Schnelli)
e8b9347 [net] remove unused return type bool from CNode::Ban() (Jonas Schnelli)
1086ffb [QA] add setban/listbanned/clearbanned tests (Jonas Schnelli)
d930b26 [RPC] add setban/listbanned/clearbanned RPC commands (Jonas Schnelli)
2252fb9 [net] extend core functionallity for ban/unban/listban (Jonas Schnelli)
2015-06-18 16:48:37 +02:00
Jonas Schnelli 1f02b80253 setban: add RPCErrorCode 2015-06-17 21:40:56 +02:00
Jonas Schnelli d624167387 fix CSubNet comparison operator 2015-06-17 21:40:55 +02:00
Jonas Schnelli 4e36e9bcc7 setban: rewrite to UniValue, allow absolute bantime 2015-06-17 21:40:55 +02:00
Jonas Schnelli 3de24d7647 rename json field "bannedtill" to "banned_until" 2015-06-17 21:40:55 +02:00
Jonas Schnelli 433fb1a95d [RPC] extend setban to allow subnets 2015-06-17 21:40:55 +02:00
Jonas Schnelli e8b93473f1 [net] remove unused return type bool from CNode::Ban() 2015-06-17 21:40:55 +02:00
Jonas Schnelli 1086ffba26 [QA] add setban/listbanned/clearbanned tests 2015-06-17 21:40:55 +02:00
Jonas Schnelli d930b26a26 [RPC] add setban/listbanned/clearbanned RPC commands 2015-06-17 21:40:55 +02:00
Jonas Schnelli 2252fb91cd [net] extend core functionallity for ban/unban/listban 2015-06-17 21:40:55 +02:00
Philip Kaufmann 0ce30eaa36 fix crash on shutdown when e.g. changing -txindex and abort action
- fixes #3136
- the problem is related to Boost path and a static initialized internal
  pointer
- using a std::string in CDBEnv::EnvShutdown() prevents the problem
- this removes the boost::filesystem::path path field from CDBEnv
2015-06-16 15:03:50 +02:00
Alex van der Peet 60dbe73016 New RPC command disconnectnode 2015-06-16 14:19:41 +02:00
Wladimir J. van der Laan a903ad7e9c
Merge pull request #6283
26a639e remove using namespace std from addrman.cpp (Philip Kaufmann)
40c592a make CAddrMan::size() return the correct type of size_t (Philip Kaufmann)
2015-06-16 14:06:59 +02:00
Wladimir J. van der Laan 57092ed9e7 rpc: make gettxoutsettinfo run lock-free
For leveldb "An iterator operates on a snapshot of the database taken
when the iterator is created". This means that it is unnecessary to
lock out other threads while computing statistics, and neither to hold
cs_main for the whole time. Let the thread run free.
2015-06-16 13:50:38 +02:00
Cory Fields a794284e61 locking: add a quick example of GUARDED_BY
This was chosen not because it's necessarily helpful, but because its locking
assumptions were already correct.
2015-06-16 04:10:21 -04:00
Cory Fields 2b890dd424 locking: fix a few small issues uncovered by -Wthread-safety
- rpcwallet: No need to lock twice here
- openssl: Clang doesn't understand selective lock/unlock here. Ignore it.
- CNode: Fix a legitimate (though very unlikely) locking bug.
2015-06-16 04:04:02 -04:00
Cory Fields cd27bba060 locking: teach Clang's -Wthread-safety to cope with our scoped lock macros
This allows us to use function/variable/class attributes to specify locking
requisites, allowing problems to be detected during static analysis.

This works perfectly with newer Clang versions (tested with 3.3-3.7). For older
versions (tested 3.2), it compiles fine but spews lots of false-positives.
2015-06-16 03:59:26 -04:00
Cory Fields 72bf90d770 Fix scheduler build with some boost versions.
Some boost versions have a conflicting overload of wait_until that returns void.
Explicitly use a template here to avoid hitting that overload.
2015-06-15 16:29:57 -04:00
Philip Kaufmann 26a639e21f remove using namespace std from addrman.cpp 2015-06-15 14:45:19 +02:00
Philip Kaufmann 40c592aa21 make CAddrMan::size() return the correct type of size_t 2015-06-15 14:43:31 +02:00
Wladimir J. van der Laan c1fb0e1075
Merge pull request #6274
02a6702 Add option `-alerts` to opt out of alert system (Wladimir J. van der Laan)
2015-06-15 09:57:33 +02:00
Wladimir J. van der Laan 02a6702a82 Add option -alerts to opt out of alert system
Make it possible to opt-out of the centralized alert system by providing
an option `-noalerts` or `-alerts=0`. The default remains unchanged.

This is a gentler form of #6260, in which I went a bit overboard by
removing the alert system completely.

I intend to add this to the GUI options in another pull after this.
2015-06-15 09:53:33 +02:00
Wladimir J. van der Laan 5ebe7db6d0
Merge pull request #6257
ef2a3de Add paytxfee to getwalletinfo, warnings to getnetworkinfo (Stephen)
2015-06-15 09:39:30 +02:00
Josh Lehan e3cae52538 Added -whiteconnections=<n> option
This sets aside a number of connection slots for whitelisted peers,
useful for ensuring your local users and miners can always get in,
even if your limit on inbound connections has already been reached.
2015-06-14 02:07:15 -07:00
Tom Harding 7d6a85ab5b Fix getbalance *
Chance "getbalance *" not to use IsTrusted.  The method and result
now match the "getbalance <specific-account>" behavior. In
particular, "getbalance * 0" now works.

Also fixed a comment -- GetGalance has required 1 confirmation
for many years, and the default "getbalance *" behavior matches
that.
2015-06-12 15:31:01 -07:00
Wladimir J. van der Laan ab0ec67903
Merge pull request #6209
e059726 [Qt] deselect peer when switching away from peers tab in RPC console (Philip Kaufmann)
7211ada [Qt] replace Boost foreach with Qt version peertablemodel.cpp (Philip Kaufmann)
1b0db7b [Qt] extend rpc console peers tab (Philip Kaufmann)
2015-06-12 16:49:53 +02:00
Wladimir J. van der Laan 8ccc07c077
Merge pull request #6256
65b9454 Use best header chain timestamps to detect partitioning (Gavin Andresen)
2015-06-12 16:44:36 +02:00
Wladimir J. van der Laan baf05075fa Improve proxy initialization
Simplify and make the code in AppInit2 more clear.

This provides a straightforward flow, gets rid of .count() (which makes
it possible to override an earlier provided proxy option to nothing), as
well as comments the different cases.
2015-06-12 12:41:44 +02:00
Wladimir J. van der Laan ebab5d3c59
Merge pull request #6266
0cc7b23 Fix univalue handling of \u0000 characters. (Daniel Kraft)
2015-06-12 09:15:26 +02:00
Stephen ef2a3de25c Add paytxfee to getwalletinfo, warnings to getnetworkinfo 2015-06-11 16:12:34 -04:00
Wladimir J. van der Laan dd8fe8215a
Merge pull request #6221
c257a8c Prune: Support noncontiguous block files (Adam Weiss)
2015-06-11 18:24:35 +02:00
Daniel Kraft 0cc7b2352e Fix univalue handling of \u0000 characters.
Univalue's parsing of \u escape sequences did not handle NUL characters
correctly.  They were, effectively, dropped.  The extended test-case
fails with the old code, and is fixed with this patch.
2015-06-11 12:09:05 +02:00
Wladimir J. van der Laan 51870fc151
Merge pull request #6264
9b5659d Remove translation for -help-debug options (Wladimir J. van der Laan)
2015-06-11 10:50:01 +02:00
Matt Corallo 21bbd920e5 Add fundrawtransaction RPC method 2015-06-11 01:03:23 -07:00
Matt Corallo 1e0d1a2ff0 Add FundTransaction method to wallet
Some code stolen from Jonas Schnelli <jonas.schnelli@include7.ch>
2015-06-11 01:03:23 -07:00