Commit Graph

12902 Commits

Author SHA1 Message Date
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
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
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
c72cc88ed3 net: remove useless comments 2017-01-12 23:05:09 -05:00
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
f5c36d19b6 net: record bytes written before notifying the message processor 2017-01-12 23:05:09 -05:00
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
fac4c78028 Make PartiallyDownloadedBlock::InitData's second param const 2017-01-12 12:20:11 -08:00
b55b416346 Add extra_count lower bound to compact reconstruction debug print 2017-01-12 12:19:14 -08:00
73666ad059 Add comment to describe callers to ActivateBestChain 2017-01-12 12:15:17 -08:00
82e8baab3c Avoid boost dynamic_bitset in rest_getutxos 2017-01-12 12:06:32 -08:00
99f001eb52 Fix memory leak in multiUserAuthorized 2017-01-12 11:52:53 -08:00
5a0b7e4106 Fix memory leak in net_tests 2017-01-12 11:52:53 -08:00
6b03bfb840 Fix memory leak in wallet tests 2017-01-12 11:52:53 -08:00
f94f3e0df8 Avoid integer overflows in scriptnum tests 2017-01-12 11:52:53 -08:00
843c560003 Avoid unaligned access in crypto i/o 2017-01-12 11:52:45 -08:00
34ede124af Document fee estimation changes 2017-01-12 12:19:08 -05:00
b348287b79 Clarify that prioritisetransaction remains supported 2017-01-12 12:09:15 -05:00
4b06e41c30 Add unit test for FindEarliestAtLeast 2017-01-12 14:22:15 +00:00
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
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
fa2973678e test: Include tx data in EXTRA_DIST 2017-01-12 13:13:07 +01:00
7cb024eba6 Merge #9222: Add 'subtractFeeFromAmount' option to 'fundrawtransaction'.
453bda6 Add 'subtractFeeFromOutputs' option to 'fundrawtransaction'. (Chris Moore)
2017-01-12 12:49:10 +01:00
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
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
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
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
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
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
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
9ec1330b45 Merge #9416: travis: make distdir before make
faaf3ca travis: make distdir before make (MarcoFalke)
2017-01-12 02:14:51 +01:00
0b738075bd Merge #9297: Various RPC help outputs updated
54ee3fc RPC help updated (Michael Rotarius)
2017-01-12 02:11:04 +01:00
db904db7e6 Deprecate non-txindex getrawtransaction and better warning 2017-01-11 15:34:13 -08:00
0df777db6d Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders 2017-01-11 14:47:52 -08:00
aad4cb5059 Address ryanofsky feedback on CCheckQueue benchmarks. Eliminated magic numbers, fixed scoping of vectors (and memory movement component of benchmark). 2017-01-11 17:05:06 -05:00
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
54ee3fcb8f RPC help updated 2017-01-11 22:05:23 +01:00
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
df3637177a Update estimated transaction count data 2017-01-11 08:21:40 -08:00
e356d9a758 Shorten variable names and switch to tx/s 2017-01-11 08:21:37 -08:00
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
ca615e6c05 Merge #9471: [depends] libevent 2.1.7rc
8217bd1 [depends] libevent 2.1.7rc (fanquake)
2017-01-11 13:56:13 +01:00
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
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
faaf3ca0af travis: make distdir before make 2017-01-11 12:25:05 +01:00
7f1fa99a21 [depends] native_ds_store 1.1.0 2017-01-11 17:34:13 +08:00
67ca130f73 build: fix for out-of-tree/distdir qt builds 2017-01-10 20:03:38 -05:00
c6347aec6c [depends] dbus 1.10.14 2017-01-11 08:44:23 +08:00
a4c6da085b [depends] ccache 3.3.3 2017-01-11 08:44:23 +08:00
6019d21a43 [depends] FreeType 2.7.1 2017-01-11 08:44:23 +08:00