Commit graph

12683 commits

Author SHA1 Message Date
Pieter Wuille e126d0c12c
Merge #9490: Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
4b06e41 Add unit test for FindEarliestAtLeast (Suhas Daftuar)
997a98a Replace FindLatestBefore used by importmuti with FindEarliestAtLeast. (Gregory Maxwell)
2017-01-13 16:06:05 -08:00
Pieter Wuille 3908fc4728
Merge #9375: Relay compact block messages prior to full block connection
02ee4eb Make most_recent_compact_block a pointer to a const (Matt Corallo)
73666ad Add comment to describe callers to ActivateBestChain (Matt Corallo)
962f7f0 Call ActivateBestChain without cs_main/with most_recent_block (Matt Corallo)
0df777d Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders (Matt Corallo)
c1ae4fc Avoid holding cs_most_recent_block while calling ReadBlockFromDisk (Matt Corallo)
9eb67f5 Ensure we meet the BIP 152 old-relay-types response requirements (Matt Corallo)
5749a85 Cache most-recently-connected compact block (Matt Corallo)
9eaec08 Cache most-recently-announced block's shared_ptr (Matt Corallo)
c802092 Relay compact block messages prior to full block connection (Matt Corallo)
6987219 Add a CValidationInterface::NewPoWValidBlock callback (Matt Corallo)
180586f Call AcceptBlock with the block's shared_ptr instead of CBlock& (Matt Corallo)
8baaba6 [qa] Avoid race in preciousblock test. (Matt Corallo)
9a0b2f4 [qa] Make compact blocks test construction using fetch methods (Matt Corallo)
8017547 Make CBlockIndex*es in net_processing const (Matt Corallo)
2017-01-13 14:52:26 -08:00
Matt Corallo 02ee4eb263 Make most_recent_compact_block a pointer to a const 2017-01-13 16:28:15 -05:00
Pieter Wuille 8b66bf74e2
Merge #9441: Net: Massive speedup. Net locks overhaul
e60360e net: remove cs_vRecvMsg (Cory Fields)
991955e net: add a flag to indicate when a node's send buffer is full (Cory Fields)
c6e8a9b net: add a flag to indicate when a node's process queue is full (Cory Fields)
4d712e3 net: add a new message queue for the message processor (Cory Fields)
c5a8b1b net: rework the way that the messagehandler sleeps (Cory Fields)
c72cc88 net: remove useless comments (Cory Fields)
ef7b5ec net: Add a simple function for waking the message handler (Cory Fields)
f5c36d1 net: record bytes written before notifying the message processor (Cory Fields)
60befa3 net: handle message accounting in ReceiveMsgBytes (Cory Fields)
56212e2 net: set message deserialization version when it's actually time to deserialize (Cory Fields)
0e973d9 net: remove redundant max sendbuffer size check (Cory Fields)
6042587 net: wait until the node is destroyed to delete its recv buffer (Cory Fields)
f6315e0 net: only disconnect if fDisconnect has been set (Cory Fields)
5b4a8ac net: make GetReceiveFloodSize public (Cory Fields)
e5bcd9c net: make vRecvMsg a list so that we can use splice() (Cory Fields)
53ad9a1 net: fix typo causing the wrong receive buffer size (Cory Fields)
2017-01-13 10:02:18 -08:00
Cory Fields e60360e139 net: remove cs_vRecvMsg
vRecvMsg is now only touched by the socket handler thread.

The accounting vars (nRecvBytes/nLastRecv/mapRecvBytesPerMsgCmd) are also
only used by the socket handler thread, with the exception of queries from
rpc/gui. These accesses are not threadsafe, but they never were. This needs to
be addressed separately.

Also, update comment describing data flow
2017-01-12 23:08:08 -05:00
Cory Fields 991955ee81 net: add a flag to indicate when a node's send buffer is full
Similar to the recv flag, but this one indicates whether or not the net's send
buffer is full.

The socket handler checks the send queue when a new message is added and pauses
if necessary, and possibly unpauses after each message is drained from its buffer.
2017-01-12 23:05:59 -05:00
Cory Fields c6e8a9bcff net: add a flag to indicate when a node's process queue is full
Messages are dumped very quickly from the socket handler to the processor, so
it's the depth of the processing queue that's interesting.

The socket handler checks the process queue's size during the brief message
hand-off and pauses if necessary, and the processor possibly unpauses each time
a message is popped off of its queue.
2017-01-12 23:05:47 -05:00
Cory Fields 4d712e366c net: add a new message queue for the message processor
This separates the storage of messages from the net and queued messages for
processing, allowing the locks to be split.
2017-01-12 23:05:25 -05:00
Cory Fields c5a8b1b946 net: rework the way that the messagehandler sleeps
In order to sleep accurately, the message handler needs to know if _any_ node
has more processing that it should do before the entire thread sleeps.

Rather than returning a value that represents whether ProcessMessages
encountered a message that should trigger a disconnnect, interpret the return
value as whether or not that node has more work to do.

Also, use a global fProcessWake value that can be set by other threads,
which takes precedence (for one cycle) over the messagehandler's decision.

Note that the previous behavior was to only process one message per loop
(except in the case of a bad checksum or invalid header). That was changed in
PR #3180.

The only change here in that regard is that the current node now falls to the
back of the processing queue for the bad checksum/invalid header cases.
2017-01-12 23:05:24 -05:00
Cory Fields c72cc88ed3 net: remove useless comments 2017-01-12 23:05:09 -05:00
Cory Fields ef7b5ecbb7 net: Add a simple function for waking the message handler
This may be used publicly in the future
2017-01-12 23:05:09 -05:00
Cory Fields f5c36d19b6 net: record bytes written before notifying the message processor 2017-01-12 23:05:09 -05:00
Cory Fields 60befa3997 net: handle message accounting in ReceiveMsgBytes
This allows locking to be pushed down to only where it's needed

Also reuse the current time rather than checking multiple times.
2017-01-12 23:05:09 -05:00
Matt Corallo 73666ad059 Add comment to describe callers to ActivateBestChain 2017-01-12 12:15:17 -08:00
Suhas Daftuar 4b06e41c30 Add unit test for FindEarliestAtLeast 2017-01-12 14:22:15 +00:00
Gregory Maxwell 997a98a674 Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
In spite of the name FindLatestBefore used std::lower_bound to try
 to find the earliest block with a nTime greater or equal to the
 the requested value.  But lower_bound uses bisection and requires
 the input to be ordered with respect to the comparison operation.
 Block times are not well ordered.

I don't know what lower_bound is permitted to do when the data
 is not sufficiently ordered, but it's probably not good.
 (I could construct an implementation which would infinite loop...)

To resolve the issue this commit introduces a maximum-so-far to the
 block indexes and searches that.

For clarity the function is renamed to reflect what it actually does.

An issue that remains is that there is no grace period in importmulti:
 If a address is created at time T and a send is immediately broadcast
 and included by a miner with a slow clock there may not yet have been
 any block with at least time T.

The normal rescan has a grace period of 7200 seconds, but importmulti
 does not.
2017-01-12 14:21:43 +00:00
MarcoFalke 02e5308c1b
Merge #9525: test: Include tx data in EXTRA_DIST
fa29736 test: Include tx data in EXTRA_DIST (MarcoFalke)
2017-01-12 13:41:32 +01:00
MarcoFalke fa2973678e test: Include tx data in EXTRA_DIST 2017-01-12 13:13:07 +01:00
Wladimir J. van der Laan 7cb024eba6
Merge #9222: Add 'subtractFeeFromAmount' option to 'fundrawtransaction'.
453bda6 Add 'subtractFeeFromOutputs' option to 'fundrawtransaction'. (Chris Moore)
2017-01-12 12:49:10 +01:00
Wladimir J. van der Laan f9117f2047
Merge #9468: [Depends] Dependency updates for 0.14.0
7f1fa99 [depends] native_ds_store 1.1.0 (fanquake)
c6347ae [depends] dbus 1.10.14 (fanquake)
a4c6da0 [depends] ccache 3.3.3 (fanquake)
6019d21 [depends] FreeType 2.7.1 (fanquake)
4ed6faf [depends] Boost 1.63.0 (fanquake)
8ac1830 [depends] Latest config.guess and config.sub (fanquake)
2017-01-12 12:46:30 +01:00
Wladimir J. van der Laan 2742568a00
Merge #9261: Add unstored orphans with rejected parents to recentRejects
dfbe0d5 Add unstored orphans with rejected parents to recentRejects (Alex Morcos)
2017-01-12 12:34:44 +01:00
Wladimir J. van der Laan d5d4ad87af
Merge #8883: Add all standard TXO types to bitcoin-tx
0c50909 testcases: explicitly specify transaction version 1 (John Newbery)
b7e144b Add test cases to test new bitcoin-tx functionality (jnewbery)
61a1534 Add all transaction output types to bitcoin-tx. (jnewbery)
1814b08 add p2sh and segwit options to bitcoin-tx outscript command (Stanislas Marion)
2017-01-12 12:24:35 +01:00
Wladimir J. van der Laan fac0f30482
Merge #9472: Disentangle progress estimation from checkpoints and update it
df36371 Update estimated transaction count data (Pieter Wuille)
e356d9a Shorten variable names and switch to tx/s (Pieter Wuille)
6dd8116 Remove SIGCHECK_VERIFICATION_FACTOR (Pieter Wuille)
3641141 Move tx estimation data out of CCheckPointData (Pieter Wuille)
a4bac66 [MOVEONLY] Move progress estimation out of checkpoints (Pieter Wuille)
2017-01-12 12:13:14 +01:00
MarcoFalke a65ced1a66
Merge #9518: Return height of last block pruned by pruneblockchain RPC
918d1fb Return height of last block pruned by pruneblockchain RPC (Russell Yanofsky)
2017-01-12 11:50:14 +01:00
MarcoFalke 2456a835f0
Merge #9520: Deprecate non-txindex getrawtransaction and better warning
db904db Deprecate non-txindex getrawtransaction and better warning (Pieter Wuille)
2017-01-12 10:52:32 +01:00
Matt Corallo 962f7f054f Call ActivateBestChain without cs_main/with most_recent_block
There is still a call to ActivateBestChain with cs_main if a peer
requests the block prior to it being validated, but this one is
more specifically-gated, so should be less of an issue.
2017-01-11 21:18:48 -08:00
MarcoFalke 9ec1330b45
Merge #9416: travis: make distdir before make
faaf3ca travis: make distdir before make (MarcoFalke)
2017-01-12 02:14:51 +01:00
MarcoFalke 0b738075bd
Merge #9297: Various RPC help outputs updated
54ee3fc RPC help updated (Michael Rotarius)
2017-01-12 02:11:04 +01:00
Pieter Wuille db904db7e6 Deprecate non-txindex getrawtransaction and better warning 2017-01-11 15:34:13 -08:00
Matt Corallo 0df777db6d Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders 2017-01-11 14:47:52 -08:00
Pieter Wuille 05950427d3
Merge #9507: Fix use-after-free in CTxMemPool::removeConflicts()
fe7e593 Fix use-after-free in CTxMemPool::removeConflicts() (Suhas Daftuar)
2017-01-11 13:59:00 -08:00
Michael Rotarius 54ee3fcb8f RPC help updated 2017-01-11 22:05:23 +01:00
Russell Yanofsky 918d1fb86b Return height of last block pruned by pruneblockchain RPC
Change suggested by Jonas Schnelli <dev@jonasschnelli.ch> in
https://github.com/bitcoin/bitcoin/pull/7871#discussion_r95577623
2017-01-11 14:25:32 -05:00
Pieter Wuille df3637177a Update estimated transaction count data 2017-01-11 08:21:40 -08:00
Pieter Wuille e356d9a758 Shorten variable names and switch to tx/s 2017-01-11 08:21:37 -08:00
Wladimir J. van der Laan e2e624d9ce
Merge #7871: Manual block file pruning.
afffeea fixup! Add pruneblockchain RPC to enable manual block file pruning. (Russell Yanofsky)
1fc4ec7 Add pruneblockchain RPC to enable manual block file pruning. (mrbandrews)
2017-01-11 14:26:00 +01:00
Wladimir J. van der Laan ca615e6c05
Merge #9471: [depends] libevent 2.1.7rc
8217bd1 [depends] libevent 2.1.7rc (fanquake)
2017-01-11 13:56:13 +01:00
Wladimir J. van der Laan 593a00ce19
Merge #9506: RFC: Improve style for if indentation
74994c6 Improve style w.r.t. if (Pieter Wuille)
2017-01-11 13:52:15 +01:00
Wladimir J. van der Laan bbf193fef0
Merge #9513: build: fix qt distdir builds (retry)
67ca130 build: fix for out-of-tree/distdir qt builds (Cory Fields)
2017-01-11 13:45:28 +01:00
MarcoFalke faaf3ca0af travis: make distdir before make 2017-01-11 12:25:05 +01:00
fanquake 7f1fa99a21
[depends] native_ds_store 1.1.0 2017-01-11 17:34:13 +08:00
Cory Fields 67ca130f73 build: fix for out-of-tree/distdir qt builds 2017-01-10 20:03:38 -05:00
fanquake c6347aec6c
[depends] dbus 1.10.14 2017-01-11 08:44:23 +08:00
fanquake a4c6da085b
[depends] ccache 3.3.3 2017-01-11 08:44:23 +08:00
fanquake 6019d21a43
[depends] FreeType 2.7.1 2017-01-11 08:44:23 +08:00
fanquake 4ed6faf381
[depends] Boost 1.63.0 2017-01-11 08:44:22 +08:00
fanquake 8ac18303da
[depends] Latest config.guess and config.sub 2017-01-11 08:44:01 +08:00
Suhas Daftuar fe7e593b24 Fix use-after-free in CTxMemPool::removeConflicts() 2017-01-10 15:21:21 -05:00
Pieter Wuille 74994c6577 Improve style w.r.t. if 2017-01-10 11:58:27 -08:00
Wladimir J. van der Laan 5754e0341b
Merge #8811: rpc: Add support for JSON-RPC named arguments
4e7e2e1 Update RPC argument names (John Newbery)
481f289 rpc: Named argument support for bitcoin-cli (Wladimir J. van der Laan)
9adb4e1 rpc: Argument name consistency (Wladimir J. van der Laan)
8d713f7 rpc: Named arguments for rawtransaction calls (Wladimir J. van der Laan)
37a166f rpc: Named arguments for wallet calls (Wladimir J. van der Laan)
78b684f rpc: Named arguments for mining calls (Wladimir J. van der Laan)
b8ebc59 rpc: Named arguments for net calls (Wladimir J. van der Laan)
2ca9dcd test: Add test for RPC named arguments (Wladimir J. van der Laan)
fba1a61 rpc: Named arguments for misc calls (Wladimir J. van der Laan)
286ec08 rpc: Add 'echo' call for testing (Wladimir J. van der Laan)
495eb44 rpc: Named arguments for blockchain calls (Wladimir J. van der Laan)
6f1c76a rpc: Support named arguments (Wladimir J. van der Laan)
5865d41 authproxy: Add support for RPC named arguments (Wladimir J. van der Laan)
2017-01-10 14:14:50 +01:00