aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-06-30 08:21:46 -0400
committerGavin Andresen <gavinandresen@gmail.com>2014-06-30 08:21:46 -0400
commit6fba25ef26649359d8e5962555c0d753b6df51b4 (patch)
tree8b10189b015d4699ad617a56292b06621b648059 /src/main.h
parentac26571d2b118b5df9e7fd2585ecac1eeb7ed94d (diff)
parent236982c2b6de619f0744c9c17ea7208b64a4afb3 (diff)
downloadbitcoin-6fba25ef26649359d8e5962555c0d753b6df51b4.tar.xz
Merge pull request #4420 from sipa/skiplist
Add a skiplist to the CBlockIndex structure.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.h b/src/main.h
index 0332db2163..1af86b065f 100644
--- a/src/main.h
+++ b/src/main.h
@@ -185,6 +185,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
struct CNodeStateStats {
int nMisbehavior;
+ int nSyncHeight;
};
struct CDiskBlockPos
@@ -676,6 +677,9 @@ public:
// pointer to the index of the predecessor of this block
CBlockIndex* pprev;
+ // pointer to the index of some further predecessor of this block
+ CBlockIndex* pskip;
+
// height of the entry in the chain. The genesis block has height 0
int nHeight;
@@ -715,6 +719,7 @@ public:
{
phashBlock = NULL;
pprev = NULL;
+ pskip = NULL;
nHeight = 0;
nFile = 0;
nDataPos = 0;
@@ -736,6 +741,7 @@ public:
{
phashBlock = NULL;
pprev = NULL;
+ pskip = NULL;
nHeight = 0;
nFile = 0;
nDataPos = 0;
@@ -868,9 +874,14 @@ public:
}
return false;
}
-};
+ // Build the skiplist pointer for this entry.
+ void BuildSkip();
+ // Efficiently find an ancestor of this block.
+ CBlockIndex* GetAncestor(int height);
+ const CBlockIndex* GetAncestor(int height) const;
+};
/** Used to marshal pointers into hashes for db storage. */
class CDiskBlockIndex : public CBlockIndex