aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2016-06-24 16:25:44 +0200
committerWladimir J. van der Laan <[email protected]>2016-06-24 18:07:44 +0200
commitd612837814020ae832499d18e6ee5eb919a87907 (patch)
treea93b5e382503577109efaa5cf7526e4dc378b7ea /src/net.cpp
parentMerge #8256: BUG: bitcoin-qt crash (diff)
parentBIP9 parameters for testnet (diff)
downloaddiscoin-d612837814020ae832499d18e6ee5eb919a87907.tar.xz
discoin-d612837814020ae832499d18e6ee5eb919a87907.zip
Merge #8149: Segregated witness rebased
f852813 BIP9 parameters for testnet (Johnson Lau) 070dbc4 --- [SEGWIT] begin: deployment --- (Pieter Wuille) fdb43df [qa] Add GetTransactionSigOpCost unit tests (Jonas Nick) d846e02 [qa] script_tests: witness tests can specify tx amount (Suhas Daftuar) 330b0f3 [qa] p2p segwit tests (Suhas Daftuar) 4f7ff00 [qa] Add rpc test for segwit (Alex Morcos) 66cca79 [qa] Autogeneration support for witness in script_tests (Pieter Wuille) 06d3805 [qa] Add segwit support to script_tests (Pieter Wuille) 00f46cb [qa] Add transaction tests for segwit (NicolasDorier) 0aa9207 [qa] Witness version 0 signing unit tests (Pieter Wuille) 978e200 --- [SEGWIT] begin: tests --- (Pieter Wuille) 745eb67 [RPC] signrawtransaction can sign P2WSH (NicolasDorier) f4691ab [RPC] Add wallet support for witness transactions (using P2SH) (Pieter Wuille) 605e847 BIP143: Signing logic (Pieter Wuille) 9757b57 --- [SEGWIT] begin: wallet --- (Pieter Wuille) af87a67 Do not use compact blocks when segwit is enabled (Pieter Wuille) 6032f69 Add rewind logic to deal with post-fork software updates (Pieter Wuille) b7dbeb2 [libconsensus] Script verification API with amounts (Thomas Kerin) 2b1f6f9 BIP141: Other consensus critical limits, and BIP145 (Pieter Wuille) 7c4bf77 [RPC] Return witness data in blockchain RPCs (Johnson Lau) 3dd4102 BIP143: Verification logic (Pieter Wuille) 0ef1dd3 Refactor script validation to observe amounts (Pieter Wuille) b8a9749 BIP144: Handshake and relay (receiver side) (Pieter Wuille) 8b49040 BIP141: Commitment structure and deployment (Pieter Wuille) 449f9b8 BIP141: Witness program (Pieter Wuille) 7030d9e BIP144: Serialization, hashes, relay (sender side) (Pieter Wuille) ecacfd9 --- [SEGWIT] begin: P2P/node/consensus --- (Pieter Wuille)
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 336163a89..4cbc43e4d 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -72,7 +72,7 @@ namespace {
const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
/** Services this node implementation cares about */
-static const ServiceFlags nRelevantServices = NODE_NETWORK;
+ServiceFlags nRelevantServices = NODE_NETWORK;
//
// Global state variables
@@ -1676,6 +1676,10 @@ void ThreadOpenConnections()
if (nANow - addr.nLastTry < 600 && nTries < 30)
continue;
+ // only consider nodes missing relevant services after 40 failed attemps
+ if ((addr.nServices & nRelevantServices) != nRelevantServices && nTries < 40)
+ continue;
+
// do not allow non-default ports, unless after 50 invalid addresses selected already
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
continue;
@@ -2178,7 +2182,7 @@ void CNode::RecordBytesSent(uint64_t bytes)
void CNode::SetMaxOutboundTarget(uint64_t limit)
{
LOCK(cs_totalBytesSent);
- uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SIZE;
+ uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE;
nMaxOutboundLimit = limit;
if (limit > 0 && limit < recommendedMinimum)
@@ -2233,7 +2237,7 @@ bool CNode::OutboundTargetReached(bool historicalBlockServingLimit)
{
// keep a large enough buffer to at least relay each block once
uint64_t timeLeftInCycle = GetMaxOutboundTimeLeftInCycle();
- uint64_t buffer = timeLeftInCycle / 600 * MAX_BLOCK_SIZE;
+ uint64_t buffer = timeLeftInCycle / 600 * MAX_BLOCK_SERIALIZED_SIZE;
if (buffer >= nMaxOutboundLimit || nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit - buffer)
return true;
}