aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-01-10 13:23:26 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2014-02-08 16:52:19 +0100
commitf59d8f0b644d49324cabd19c58cf2262d49e1392 (patch)
treeb699fa0e1f6a0ca3fc09ef0ef50c4f30a6ad5b9c /src/main.h
parent95e66247ebaac88dadd081f850ebf86c71831e61 (diff)
downloadbitcoin-f59d8f0b644d49324cabd19c58cf2262d49e1392.tar.xz
Per-peer block download tracking and stalled download detection.
Keep track of which block is being requested (and to be requested) from each peer, and limit the number of blocks in-flight per peer. In addition, detect stalled downloads, and disconnect if they persist for too long. This means blocks are never requested twice, and should eliminate duplicate downloads during synchronization.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index 05210e5164..159a665466 100644
--- a/src/main.h
+++ b/src/main.h
@@ -59,6 +59,11 @@ static const int COINBASE_MATURITY = 100;
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
/** Maximum number of script-checking threads allowed */
static const int MAX_SCRIPTCHECK_THREADS = 16;
+/** Number of blocks that can be requested at any given time from a single peer. */
+static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 128;
+/** Timeout in seconds before considering a block download peer unresponsive. */
+static const unsigned int BLOCK_DOWNLOAD_TIMEOUT = 60;
+
#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
@@ -182,6 +187,9 @@ bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned in
bool AbortNode(const std::string &msg);
/** Get statistics from node state */
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats);
+/** Increase a node's misbehavior score. */
+void Misbehaving(NodeId nodeid, int howmuch);
+
/** (try to) add transaction to memory pool **/
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,