Commit graph

149 commits

Author SHA1 Message Date
Cory Fields c72cc88ed3 net: remove useless comments 2017-01-12 23:05:09 -05: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
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
Matt Corallo 863edb45b9 Consider all (<100k memusage) txn for compact-block-extra-txn cache 2017-01-10 14:48:42 -05:00
Matt Corallo 7f8c8cab1e Consider all orphan txn for compact-block-extra-txn cache 2017-01-10 14:48:42 -05:00
Matt Corallo 93380c5247 Use replaced transactions in compact block reconstruction 2017-01-10 14:48:42 -05:00
Matt Corallo 1531652e02 Keep shared_ptrs to recently-replaced txn for compact blocks 2017-01-10 14:48:42 -05:00
Matt Corallo e6111b2398 Make peer id logging consistent ("peer=%d" instead of "peer %d") 2017-01-07 16:19:34 -05:00
Matt Corallo c1ae4fcf7d Avoid holding cs_most_recent_block while calling ReadBlockFromDisk 2017-01-05 15:16:34 -05: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
Matt Corallo 9eb67f5000 Ensure we meet the BIP 152 old-relay-types response requirements
In order to do this, we must call ActivateBestChain prior to
responding getdata requests for blocks which we announced using
compact blocks.

For getheaders responses we dont need code changes, but do note
that we must reset the bestHeaderSent so that the SendMessages call
re-announces the header in question.

While we could do something smarter for getblocks, calling
ActivateBestChain is simple and more obviously correct, instead of
doing something more similar to getheaders.

See-also the BIP clarifications at
https://github.com/bitcoin/bips/pull/486
2017-01-05 10:32:07 -05:00
Matt Corallo 5749a853b9 Cache most-recently-connected compact block 2017-01-05 10:32:07 -05:00
Matt Corallo 9eaec08dd2 Cache most-recently-announced block's shared_ptr 2017-01-05 10:32:07 -05:00
Matt Corallo c802092142 Relay compact block messages prior to full block connection 2017-01-05 10:32:07 -05:00
Matt Corallo 80175472d1 Make CBlockIndex*es in net_processing const 2017-01-04 15:56:08 -05:00
Cory Fields 56212e20ac net: set message deserialization version when it's actually time to deserialize
We'll soon no longer have access to vRecvMsg, and this is more intuitive anyway.
2017-01-04 10:10:35 -05:00
Cory Fields 0e973d970a net: remove redundant max sendbuffer size check
This is left-over from before there was proper accounting. Hitting 2x the
sendbuffer size should not be possible.
2017-01-04 10:10:35 -05:00
Cory Fields e5bcd9c84f net: make vRecvMsg a list so that we can use splice() 2017-01-04 09:29:14 -05:00
Wladimir J. van der Laan 869781c51c
Merge #9283: A few more CTransactionRef optimizations
91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
2017-01-04 12:23:10 +01:00
Cory Fields 5cb0fcee81 net: remove thread_interrupted catch
This is now a std::thread, so there's no hope of catching a boost interruption
point.
2017-01-03 17:56:21 -05:00
Cory Fields d3d7056d2a net: make net processing interruptible 2017-01-03 17:56:20 -05:00
Pieter Wuille ce5c1f4aca
Merge #9252: Release cs_main before calling ProcessNewBlock, or processing headers (cmpctblock handling)
bd02bdd Release cs_main before processing cmpctblock as header (Suhas Daftuar)
680b0c0 Release cs_main before calling ProcessNewBlock (cmpctblock handling) (Suhas Daftuar)
2017-01-03 13:52:16 -08:00
Gregory Sanders d4781ac6c2 Set peers as HB peers upon full block validation 2016-12-30 14:05:13 -05:00
Suhas Daftuar bd02bddb93 Release cs_main before processing cmpctblock as header 2016-12-26 05:34:54 -05:00
Suhas Daftuar 680b0c0138 Release cs_main before calling ProcessNewBlock (cmpctblock handling) 2016-12-26 05:30:26 -05:00
Matt Corallo 4cd373aea8 Un-expose mapArgs from utils.h 2016-12-24 11:29:33 -05:00
Matt Corallo 0cf86a6678 Introduce (and use) an IsArgSet accessor method 2016-12-23 21:30:16 -05:00
Pieter Wuille 62607d796c Convert COrphanTx to keep a CTransactionRef 2016-12-21 18:18:28 -08:00
Pieter Wuille c44e4c467c Make AcceptToMemoryPool take CTransactionRef 2016-12-21 18:18:23 -08:00
Wladimir J. van der Laan e8cfe1ee2d
Merge #8589: Inline CTxInWitness inside CTxIn
f6fb7ac Move CTxInWitness inside CTxIn (Pieter Wuille)
2016-12-21 14:04:06 +01:00
Wladimir J. van der Laan a7f76512d9
Merge #9352: Attempt reconstruction from all compact block announcements
813ede9 [qa] Update compactblocks test for multi-peer reconstruction (Suhas Daftuar)
7017298 Allow compactblock reconstruction when block is in flight (Suhas Daftuar)
2016-12-19 08:52:42 +01:00
MarcoFalke fa16b8fdba If we don't allow free txs, always send a fee filter (take 2) 2016-12-16 14:27:55 +01:00
Wladimir J. van der Laan 756374c522
Merge #9313: If we don't allow free txs, always send a fee filter
01fea7a If we don't allow free txs, always send a fee filter (Alex Morcos)
2016-12-15 19:45:54 +01:00
Suhas Daftuar 7017298eb2 Allow compactblock reconstruction when block is in flight 2016-12-15 11:47:04 -05:00
Wladimir J. van der Laan b68685a16a
Merge #9273: Remove unused CDiskBlockPos* argument from ProcessNewBlock
a13fa4c Remove unused CDiskBlockPos* argument from ProcessNewBlock (Matt Corallo)
2016-12-14 10:56:28 +01:00
Gregory Maxwell da9cdd2c9c Do not run functions with necessary side-effects in assert() 2016-12-14 01:50:00 +00:00
Alex Morcos 01fea7a048 If we don't allow free txs, always send a fee filter 2016-12-09 15:25:46 -05:00
Pieter Wuille 09c4fd157c
Merge #9268: Fix rounding privacy leak introduced in #9260
9b9324e Fix rounding privacy leak introduced in #9260 (Matt Corallo)
2016-12-06 13:33:01 -08:00
Wladimir J. van der Laan 43e8150ef6
Merge #9269: Align struct COrphan definition
2efc438 Align struct COrphan definition (Pieter Wuille)
2016-12-05 11:09:26 +01:00
Pieter Wuille 2efc43874c Align struct COrphan definition 2016-12-05 00:35:07 -08:00
Pieter Wuille f6fb7acda4 Move CTxInWitness inside CTxIn 2016-12-04 23:47:12 -08:00
Wladimir J. van der Laan d04aebaec7
Merge #9014: Fix block-connection performance regression
dd0df81 Document ConnectBlock connectTrace postconditions (Matt Corallo)
2d6e561 Switch pblock in ProcessNewBlock to a shared_ptr (Matt Corallo)
2736c44 Make the optional pblock in ActivateBestChain a shared_ptr (Matt Corallo)
ae4db44 Create a shared_ptr for the block we're connecting in ActivateBCS (Matt Corallo)
fd9d890 Keep blocks as shared_ptrs, instead of copying txn in ConnectTip (Matt Corallo)
6fdd43b Add struct to track block-connect-time-generated info for callbacks (Matt Corallo)
2016-12-05 08:07:45 +01:00
Matt Corallo a13fa4c80f Remove unused CDiskBlockPos* argument from ProcessNewBlock 2016-12-04 00:23:17 -08:00
Matt Corallo 2d6e5619af Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a562
2016-12-04 00:17:30 -08:00
Alex Morcos dfbe0d530f Add unstored orphans with rejected parents to recentRejects 2016-12-03 08:38:20 -05:00
Matt Corallo 9b9324ee49 Fix rounding privacy leak introduced in #9260 2016-12-02 21:30:36 -08:00
Pieter Wuille 81e3228fcb Make CTransaction actually immutable 2016-12-02 18:37:43 -08: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