Commit graph

952 commits

Author SHA1 Message Date
Pieter Wuille 46b249e578
Merge #9408: Allow shutdown during LoadMempool, dump only when necessary
325e400 [Qt] Do proper shutdown (Jonas Schnelli)
9479f8d Allow shutdown during LoadMempool, dump only when necessary (Jonas Schnelli)
2017-01-06 09:37:43 -08:00
Pieter Wuille a55716abe5
Merge #9319: Break addnode out from the outbound connection limits.
032ba3f RPC help documentation for addnode peerinfo. (Gregory Maxwell)
90f13e1 Add release notes for addnode changes. (Gregory Maxwell)
50bd12c Break addnode out from the outbound connection limits. (Gregory Maxwell)
2017-01-06 08:37:47 -08:00
Pieter Wuille c252685aa5
Merge #8610: Share unused mempool memory with coincache
ba3cecf Share unused mempool memory with coincache (Pieter Wuille)
2017-01-05 13:52:24 -08:00
Gregory Maxwell 50bd12ce0c Break addnode out from the outbound connection limits.
Previously addnodes were in competition with outbound connections
 for access to the eight outbound slots.

One result of this is that frequently a node with several addnode
 configured peers would end up connected to none of them, because
 while the addnode loop was in its two minute sleep the automatic
 connection logic would fill any free slots with random peers.
 This is particularly unwelcome to users trying to maintain links
 to specific nodes for fast block relay or purposes.

Another result is that a group of nine or more nodes which are
 have addnode configured towards each other can become partitioned
 from the public network.

This commit introduces a new limit of eight connections just for
 addnode peers which is not subject to any of the other connection
 limitations (including maxconnections).

The choice of eight is sufficient so that under no condition would
 a user find themselves connected to fewer addnoded peers than
 previously.  It is also low enough that users who are confused
 about the significance of more connections and have gotten too
 copy-and-paste happy will not consume more than twice the slot
 usage of a typical user.

Any additional load on the network resulting from this will likely
 be offset by a reduction in users applying even more wasteful
 workaround for the prior behavior.

The retry delays are reduced to avoid nodes sitting around without
 their added peers up, but are still sufficient to prevent overly
 aggressive repeated connections.  The reduced delays also make
 the system much more responsive to the addnode RPC.

Ban-disconnects are also exempted for peers added via addnode since
 the outbound addnode logic ignores bans.  Previously it would ban
 an addnode then immediately reconnect to it.

A minor change was also made to CSemaphoreGrant so that it is
 possible to re-acquire via an object whos grant was moved.
2017-01-05 19:02:09 +00:00
MarcoFalke c2ea1e6561
Merge #9401: Make rpcauth help message clearer, add example in example .conf
0513c70 Make rpcauth help message clearer, add example in example .conf (Gregory Sanders)
2017-01-04 13:00:12 +01:00
Wladimir J. van der Laan d9ae1cefa0
Merge #9289: net: drop boost::thread_group
67ee4ec net: misc header cleanups (Cory Fields)
8b3159e net: make proxy receives interruptible (Cory Fields)
5cb0fce net: remove thread_interrupted catch (Cory Fields)
d3d7056 net: make net processing interruptible (Cory Fields)
0985052 net: make net interruptible (Cory Fields)
799df91 net: add CThreadInterrupt and InterruptibleSleep (Cory Fields)
7325b15 net: a few small cleanups before replacing boost threads (Cory Fields)
2017-01-04 12:21:53 +01:00
Cory Fields 0985052319 net: make net interruptible
Also now that net threads are interruptible, switch them to use std
threads/binds/mutexes/condvars.
2017-01-03 17:53:09 -05:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Matt Corallo 4cd373aea8 Un-expose mapArgs from utils.h 2016-12-24 11:29:33 -05:00
Matt Corallo 71fde5563b Get rid of mapArgs direct access in ZMQ construction 2016-12-24 11:10:39 -05:00
Matt Corallo 0cf86a6678 Introduce (and use) an IsArgSet accessor method 2016-12-23 21:30:16 -05:00
Matt Corallo 2b5f085ad1 Fix non-const mapMultiArgs[] access after init.
Swap mapMultiArgs for a const-reference to a _mapMultiArgs which is
only accessed in util.cpp
2016-12-23 21:30:15 -05:00
Jonas Schnelli 9479f8dfcf
Allow shutdown during LoadMempool, dump only when necessary 2016-12-23 14:19:38 +01:00
Pieter Wuille ba3cecf5c4 Share unused mempool memory with coincache
If the mempool is not completely full, treat the difference between
the maximum size and the actual usage as available for the coin cache.

This also changes the early flush trigger from (usage > 0.9 * space)
to (usage > 0.9 * space && usage > space - 100MB). This means we're not
permanently leaving 10% of the space unused when the space is large.
2016-12-22 15:04:05 -08:00
Gregory Sanders 0513c707aa Make rpcauth help message clearer, add example in example .conf 2016-12-21 09:39:45 -05:00
Wladimir J. van der Laan 7f72568e6b
Merge #9236: Fix races for strMiscWarning and fLargeWork*Found, make QT runawayException use GetWarnings
749be01 Move GetWarnings() into its own file. (Gregory Maxwell)
e3ba0ef Eliminate data races for strMiscWarning and fLargeWork*Found. (Gregory Maxwell)
c63198f Make QT runawayException call GetWarnings instead of directly access strMiscWarning. (Gregory Maxwell)
2016-12-19 12:40:01 +01:00
Wladimir J. van der Laan c9e00591cd
Merge #9322: [qa] Don't set unknown rpcserialversion
fa615d3 [qa] Don't set unknown rpcserialversion (MarcoFalke)
80d073c Complain when unknown rpcserialversion is specified (Pieter Wuille)
2016-12-15 20:10:36 +01:00
Pieter Wuille b83264d9c7
Merge #8895: Better SigCache Implementation
67dac4e Add unit tests for the CuckooCache (Jeremy Rubin)
c9e69fb Add CuckooCache implementation and replace the sigcache map_type with it (Jeremy Rubin)
2016-12-14 18:14:02 -08:00
Jeremy Rubin c9e69fbf39 Add CuckooCache implementation and replace the sigcache map_type with it
SQUASHME: Change cuckoocache to only work for powers of two, to avoid mod operator
SQUASHME: Update Documentation and simplify logarithm logic
SQUASHME: OSX Build Errors
SQUASHME: minor Feedback from sipa + bluematt
SQUASHME: DOCONLY: Clarify a few comments.
2016-12-14 16:02:05 -05:00
Pieter Wuille 80d073c9bc Complain when unknown rpcserialversion is specified 2016-12-05 23:26:32 -08:00
Gregory Sanders bc7ff8db99 Add option to return non-segwit serialization via rpc 2016-12-05 07:43:22 -05:00
Gregory Maxwell 749be013f5 Move GetWarnings() into its own file. 2016-12-03 07:17:34 +00:00
Pieter Wuille 2efcfa5acf
Merge #9260: Mrs Peacock in The Library with The Candlestick (killed main.{h,cpp})
76faa3c Rename the remaining main.{h,cpp} to validation.{h,cpp} (Matt Corallo)
e736772 Move network-msg-processing code out of main to its own file (Matt Corallo)
87c35f5 Remove orphan state wipe from UnloadBlockIndex. (Matt Corallo)
2016-12-02 18:25:40 -08:00
MarcoFalke c36229b0b2
Merge #9251: Improvement of documentation of command line parameter 'whitelist'
8a70a9d Improvement of documentation of command line parameter 'whitelist' (wodry)
2016-12-02 20:34:06 +01:00
Matt Corallo 76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Matt Corallo e736772c56 Move network-msg-processing code out of main to its own file 2016-12-02 09:42:51 -08:00
Matt Corallo 9e1f46821d Fix calculation of number of bound sockets to use 2016-11-30 18:56:08 -08:00
Pieter Wuille a143b88dbd
Merge #9010: Split up AppInit2 into multiple phases, daemonize after datadir lock errors
deec83f init: Get rid of fServer flag (Wladimir J. van der Laan)
16ca0bf init: Try to aquire datadir lock before and after daemonization (Wladimir J. van der Laan)
0cc8b6b init: Split up AppInit2 into multiple phases (Wladimir J. van der Laan)
2016-11-30 16:11:14 -08:00
wodry 8a70a9da3d Improvement of documentation of command line parameter 'whitelist' 2016-11-30 21:40:21 +01:00
Wladimir J. van der Laan deec83fd2c init: Get rid of fServer flag
There is no need to store this flag globally, the variable is only used
inside the initialization process.

Thanks to Alex Morcos for the idea.
2016-11-29 12:47:13 +01:00
Wladimir J. van der Laan 16ca0bfd28 init: Try to aquire datadir lock before and after daemonization
Before daemonization, just probe the data directory lock and print an
early error message if possible.

After daemonization get the data directory lock again and hold on to it until exit
This creates a slight window for a race condition to happen, however this condition is harmless: it
will at most make us exit without printing a message to console.

    $ src/bitcoind -testnet -daemon
    Bitcoin server starting
    $ src/bitcoind -testnet -daemon
    Error: Cannot obtain a lock on data directory /home/orion/.bitcoin/testnet3. Bitcoin Core is probably already running.
2016-11-29 12:47:13 +01:00
Wladimir J. van der Laan 0cc8b6bc44 init: Split up AppInit2 into multiple phases
This allows doing some of the steps before e.g. daemonization and some
fater.
2016-11-29 12:47:13 +01:00
Wladimir J. van der Laan 40022fe5f2
Merge #9142: Move -salvagewallet, -zap(wtx) to where they belong
2e44893 Move -salvagewallet, -zap(wtx) to where they belong (Jonas Schnelli)
2016-11-23 07:18:24 +01:00
Jonas Schnelli 2e44893081
Move -salvagewallet, -zap(wtx) to where they belong 2016-11-12 10:25:34 +01:00
Alex Morcos 79f755db41 Unset fImporting for loading mempool 2016-11-11 09:33:16 -05:00
Wladimir J. van der Laan 3665483be7
Merge #8969: Decouple peer-processing-logic from block-connection-logic (#2)
f5b960b Move nTimeBestReceived updating into net processing code (Matt Corallo)
d8670fb Move all calls to CheckBlockIndex out of net-processing logic (Matt Corallo)
d6ea737 Remove network state wipe from UnloadBlockIndex. (Matt Corallo)
fc0c24f Move MarkBlockAsReceived out of ProcessNewMessage (Matt Corallo)
65f35eb Move FlushStateToDisk call out of ProcessMessages::TX into ATMP (Matt Corallo)
2016-11-03 16:31:32 +01:00
Wladimir J. van der Laan 6a1343f73b
Merge #8977: [Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread)
cab1da7 [Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread) (Jonas Schnelli)
2016-11-02 21:37:43 +01:00
Wladimir J. van der Laan c05db83488
Merge #9013: Trivial: Explicitly pass const CChainParams& to LoadBlockIndexDB()
d0b01f3 Explicitly pass const CChainParams& to LoadBlockIndexDB() (Geoffrey Tsui)
2016-11-02 21:09:27 +01:00
Matt Corallo d6ea737be1 Remove network state wipe from UnloadBlockIndex.
UnloadBlockIndex is only used during init if we end up reindexing
to clear our block state so that we can start over. However, at
that time no connections have been brought up as CConnman hasn't
been started yet, so all of the network processing state logic is
empty when its called.

Additionally, the initialization of the recentRejects set is moved
to InitPeerLogic.
2016-10-31 10:08:11 -04:00
Pieter Wuille 3f78562df5 Add DumpMempool and LoadMempool 2016-10-31 00:10:36 -07:00
Geoffrey Tsui d0b01f3a85 Explicitly pass const CChainParams& to LoadBlockIndexDB() 2016-10-25 22:35:26 +08:00
Gregory Maxwell 515e2642eb Make connect=0 disable automatic outbound connections.
Otherwise it just responds to this obvious bit of configuration by
 trying to connect to "0" in a loop.
2016-10-25 06:17:43 +00:00
Jonas Schnelli cab1da745b
[Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread) 2016-10-20 09:22:13 +02:00
Jorge Timón 6f2f639cdf
Chainparams: Trivial: In AppInit2(), s/Params()/chainparams/ 2016-10-19 19:01:10 +02:00
Wladimir J. van der Laan c587577356
Merge #8928: Fix init segfault where InitLoadWallet() calls ATMP before genesis
37aefff Fix init segfault where InitLoadWallet() calls ATMP before genesis (Matt Corallo)
2016-10-19 18:11:15 +02:00
Wladimir J. van der Laan 05998da5a7
Merge #8865: Decouple peer-processing-logic from block-connection-logic
a9aec5c Use BlockChecked signal to send reject messages from mapBlockSource (Matt Corallo)
7565e03 Remove SyncWithWallets wrapper function (Matt Corallo)
12ee1fe Always call UpdatedBlockTip, even if blocks were only disconnected (Matt Corallo)
f5efa28 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain (Matt Corallo)
fef1010 Use CValidationInterface from chain logic to notify peer logic (Matt Corallo)
aefcb7b Move net-processing logic definitions together in main.h (Matt Corallo)
0278fb5 Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) (Matt Corallo)
87e7d72 Make validationinterface.UpdatedBlockTip more verbose (Matt Corallo)
2016-10-18 22:48:51 +02:00
instagibbs b2e93a343e Add cmpctblock to debug help list 2016-10-17 16:44:57 +02:00
Matt Corallo 37aefff5fc Fix init segfault where InitLoadWallet() calls ATMP before genesis 2016-10-15 13:19:16 -04:00
Matt Corallo fef1010199 Use CValidationInterface from chain logic to notify peer logic
This adds a new CValidationInterface subclass, defined in main.h,
to receive notifications of UpdatedBlockTip and use that to push
blocks to peers, instead of doing it directly from
ActivateBestChain.
2016-10-04 13:49:44 -04:00
Jorge Timón 3450c18a12
Globals: Decouple GetConfigFile and ReadConfigFile from global mapArgs 2016-10-01 08:12:19 +02:00