Commit graph

12284 commits

Author SHA1 Message Date
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 87c35f5843 Remove orphan state wipe from UnloadBlockIndex.
As orphan state is now "network state", like in
d6ea737be1,

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.
2016-12-01 16:08:34 -08:00
Pieter Wuille dc6dee41f7
Merge #9183: Final Preparation for main.cpp Split
2c8c57e Document cs_main status when calling into PNB or PNBH (Matt Corallo)
58a215c Use ProcessNewBlockHeaders in CMPCTBLOCK processing (Matt Corallo)
a8b936d Use exposed ProcessNewBlockHeaders from ProcessMessages (Matt Corallo)
63fd101 Split ::HEADERS processing into two separate cs_main locks (Matt Corallo)
4a6b1f3 Expose AcceptBlockHeader through main.h (Matt Corallo)
2016-12-01 16:07:25 -08:00
Pieter Wuille ad826b3df9
Merge #9188: Make orphan parent fetching ask for witnesses.
5b0150a Make orphan parent fetching ask for witnesses. (Gregory Maxwell)
2016-12-01 13:34:49 -08:00
Pieter Wuille c1a5227684
Merge #9253: Fix calculation of number of bound sockets to use
9e1f468 Fix calculation of number of bound sockets to use (Matt Corallo)
2016-12-01 13:07:08 -08:00
Matt Corallo 2c8c57e72f Document cs_main status when calling into PNB or PNBH 2016-12-01 11:03:32 -08:00
Matt Corallo 58a215ce8c Use ProcessNewBlockHeaders in CMPCTBLOCK processing 2016-12-01 11:03:31 -08:00
Matt Corallo a8b936df20 Use exposed ProcessNewBlockHeaders from ProcessMessages 2016-12-01 11:03:31 -08:00
Wladimir J. van der Laan c79e52ad30
Merge #9230: Fix some benign races in timestamp logging
8b22efb Make fStartedNewLine an std::atomic_bool (Matt Corallo)
507145d Fix race when accessing std::locale::classic() (Matt Corallo)
2016-12-01 11:47:47 +01:00
Matt Corallo 9e1f46821d Fix calculation of number of bound sockets to use 2016-11-30 18:56:08 -08:00
Pieter Wuille 3bf06e9bac
Merge #9226: Remove fNetworkNode and pnodeLocalHost.
bdb922b Remove pnodeLocalHost. (Gregory Maxwell)
083f203 Remove fNetworkNode. (Gregory Maxwell)
2016-11-30 17:15:58 -08:00
Pieter Wuille 72ae6f8cf0
Merge #9244: Trivial refactor: Remove extern keyword from function declarations
446a8f9 Trivial refactor: Remove extern keyword from function declarations, as they are extern by default. (Karl-Johan Alm)
2016-11-30 16:15:20 -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
Wladimir J. van der Laan 56bee4986d
Merge #9234: torcontrol: Explicitly request RSA1024 private key
7d3b627 torcontrol: Explicitly request RSA1024 private key (Wladimir J. van der Laan)
2016-11-30 12:45:16 +01:00
Karl-Johan Alm 446a8f9c90 Trivial refactor: Remove extern keyword from function declarations, as they are extern by default. 2016-11-30 10:27:21 +09: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 e56cf67e6b
Merge #9202: bench: Add support for measuring CPU cycles
3532818 bench: Add support for measuring CPU cycles (Wladimir J. van der Laan)
2016-11-29 12:41:33 +01:00
Wladimir J. van der Laan 5488514b90
Merge #9225: Fix some benign races
dfed983 Fix unlocked access to vNodes.size() (Matt Corallo)
3033522 Remove double brackets in addrman (Matt Corallo)
dbfaade Fix AddrMan locking (Matt Corallo)
047ea10 Make fImporting an std::atomic (Matt Corallo)
42071ca Make fDisconnect an std::atomic (Matt Corallo)
2016-11-29 12:39:33 +01:00
Wladimir J. van der Laan 0a0441358c
Merge #9224: Prevent FD_SETSIZE error building on OpenBSD
498a1d7 Include select.h when WIN32 is not defined (Ivo van der Sangen)
2016-11-29 12:37:39 +01:00
Ivo van der Sangen 498a1d75e7 Include select.h when WIN32 is not defined 2016-11-29 12:35:41 +01:00
MarcoFalke 7bd1aa566f
Merge #9233: Fix some typos
15fa95d Fix some typos (fsb4000)
2016-11-29 11:13:57 +01:00
Wladimir J. van der Laan 7d3b627395 torcontrol: Explicitly request RSA1024 private key
When generating a new service key, explicitly request a RSA1024 one.

The bitcoin P2P protocol has no support for the longer hidden service names
that will come with ed25519 keys, until it does, we depend on the old
hidden service type so make this explicit.

See #9214.
2016-11-28 17:18:46 +01:00
fsb4000 15fa95d7e5 Fix some typos 2016-11-28 16:16:37 +07:00
Matt Corallo 8b22efb6f7 Make fStartedNewLine an std::atomic_bool
While this doesnt really fix the race of adding timestamps
mid-logical-line, it avoids the undefined behavior of using a
bool in multiple threads.
2016-11-27 15:36:44 -08:00
Matt Corallo 507145d785 Fix race when accessing std::locale::classic()
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78552
2016-11-27 15:36:44 -08:00
MarcoFalke c4522e71c7
Merge #9219: doc: Improve windows build instructions using Linux subsystem
dd34570 doc: Improve windows build instructions using Linux subsystem (Wladimir J. van der Laan)
2016-11-27 14:58:25 +01:00
Gregory Maxwell bdb922b34c Remove pnodeLocalHost.
Mostly a legacy of the long removed pub/sub system.
2016-11-27 04:19:37 +00:00
Gregory Maxwell 083f203698 Remove fNetworkNode.
Matt pointed out to me that this appeared to be doing nothing (except involving itself in data races).
2016-11-27 04:13:54 +00:00
Matt Corallo dfed983f19 Fix unlocked access to vNodes.size() 2016-11-26 15:42:55 -08:00
Matt Corallo 303352286f Remove double brackets in addrman 2016-11-26 15:42:55 -08:00
Matt Corallo dbfaade72a Fix AddrMan locking 2016-11-26 15:42:55 -08:00
Matt Corallo 047ea1052d Make fImporting an std::atomic 2016-11-26 15:42:48 -08:00
Matt Corallo 42071ca264 Make fDisconnect an std::atomic 2016-11-25 18:03:12 -08:00
Pieter Wuille 76fec09d87
Merge #9128: net: Decouple CConnman and message serialization
c7be56d net: push only raw data into CConnman (Cory Fields)
2ec935d net: add CVectorWriter and CNetMsgMaker (Cory Fields)
b7695c2 net: No need to check individually for disconnection anymore (Cory Fields)
fedea8a net: don't send any messages before handshake or after requested disconnect (Cory Fields)
d74e352 net: Set feelers to disconnect at the end of the version message (Cory Fields)
2016-11-25 11:18:23 -08:00
Cory Fields c7be56dcef net: push only raw data into CConnman
This fixes one of the last major layer violations in the networking stack.

The network side is no longer in charge of message serialization, so it is now
decoupled from Bitcoin structures. Only the header is serialized and attached
to the payload.
2016-11-25 12:37:33 -05:00
Cory Fields 2ec935dcaa net: add CVectorWriter and CNetMsgMaker
CVectorWriter is useful for overwriting or appending an existing byte vector.

CNetMsgMaker is a shortcut for creating messages on-the-fly which are suitable
for pushing to CConnman.
2016-11-25 12:09:58 -05:00
Cory Fields b7695c2275 net: No need to check individually for disconnection anymore 2016-11-25 12:09:58 -05:00
MarcoFalke e22f409f18
Merge #9220: Refactor: Stop using namespace std (bitcoin-cli/-tx).
2f2625a Removed using namespace std from bitcoin-cli/-tx and added std:: in appropriate places. (Karl-Johan Alm)
2016-11-25 11:35:53 +01:00
MarcoFalke 97ec6e5c90
Merge #9100: tx_valid: re-order inputs to how they are encoded
5262a15 tx_valid: re-order inputs to how they are encoded (Daniel Cousens)
2016-11-25 10:38:19 +01:00
Wladimir J. van der Laan dd34570c45 doc: Improve windows build instructions using Linux subsystem
I did a build on a windows 10 laptop and took notes, and tried
to improve the document:

- It's the Linux subsystem for Windows, not the other way around.

- Split out dependencies: general ones, 64-bit, 32-bit. Remove the
  reference to `build-unix.md`, easy enough to be self-contained.

- Place 64-bit instructions first. 99% will want these.

- Installation instructions: recommend using `/` for prefix, same as we
  do on gitian builds. This will allow copying the files to a usable
  (from Windows) place using just `make DESTDIR=...`.

- Remove double spaces / consistent width reformatting.
2016-11-25 09:32:34 +01:00
Karl-Johan Alm 2f2625a0bb Removed using namespace std from bitcoin-cli/-tx and added std:: in appropriate places. 2016-11-25 17:17:57 +09:00
Wladimir J. van der Laan d932159f34
Merge #9189: Always add default_witness_commitment with GBT client support
95f4a03 [qa] Test getblocktemplate default_witness_commitment (Suhas Daftuar)
ad04d1c Always add default_witness_commitment with GBT client support (Pieter Wuille)
2016-11-25 08:26:25 +01:00
MarcoFalke bc121b0eb1
Merge #9216: Doc: Fix copypasted comment
f26da35 Fix copypasted comment. (Pavel Janík)
2016-11-24 14:00:34 +01:00
MarcoFalke c98f6b3d93
Merge #9144: [Trivial] Correct waitforblockheight example help text
e3c4f7e Correct help output for waitfor RPC commands (fanquake)
2016-11-24 13:14:06 +01:00
fanquake e3c4f7e182
Correct help output for waitfor RPC commands 2016-11-24 19:50:07 +08:00
Wladimir J. van der Laan db5e22e053
Merge #9190: qt: Plug many memory leaks
ed998ea qt: Avoid OpenSSL certstore-related memory leak (Wladimir J. van der Laan)
5204598 qt: Avoid shutdownwindow-related memory leak (Wladimir J. van der Laan)
e4f126a qt: Avoid splash-screen related memory leak (Wladimir J. van der Laan)
693384e qt: Prevent thread/memory leak on exiting RPCConsole (Wladimir J. van der Laan)
47db075 qt: Plug many memory leaks (Wladimir J. van der Laan)
2016-11-24 12:17:39 +01:00
Pavel Janík f26da35142 Fix copypasted comment. 2016-11-24 12:12:57 +01:00
Cory Fields fedea8a14d net: don't send any messages before handshake or after requested disconnect
Also, send reject messages earlier in SendMessages(), so that disconnections are
processed earlier.

These changes combined should ensure that no message is ever sent after
fDisconnect is set.
2016-11-23 19:53:28 -05:00