aboutsummaryrefslogtreecommitdiff
path: root/src/chain.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-10-17 12:24:29 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-10-17 12:30:54 +0200
commit84d13eef883769451ba9f77b56d9738d24474d5c (patch)
treecc161844cd5cd599a3eac8787dffb11c16118cc4 /src/chain.h
parent8e9a665f5518637b618d8b1f74d440ac07b482cf (diff)
parente11b2ce4c63b87efa60b163b50d155969ccd7e08 (diff)
downloadbitcoin-84d13eef883769451ba9f77b56d9738d24474d5c.tar.xz
Merge pull request #4468
e11b2ce Fix large reorgs (Pieter Wuille) afc32c5 Fix rebuild-chainstate feature and improve its performance (Pieter Wuille) 16d5194 Skip reindexed blocks individually (Pieter Wuille) ad96e7c Make -reindex cope with out-of-order blocks (Wladimir J. van der Laan) e17bd58 Rename setBlockIndexValid to setBlockIndexCandidates (Pieter Wuille) 1af838b Add height to "Requesting block" debug (R E Broadley) 1bcee67 Better logging of stalling (R E Broadley) 4c93322 Improve getheaders (sending) logging (R E Broadley) f244c99 Remove CheckMinWork, as we always know all parent headers (Pieter Wuille) ad6e601 RPC additions after headers-first (Pieter Wuille) 341735e Headers-first synchronization (Pieter Wuille)
Diffstat (limited to 'src/chain.h')
-rw-r--r--src/chain.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/chain.h b/src/chain.h
index 0aafb40b98..4e6a466c6a 100644
--- a/src/chain.h
+++ b/src/chain.h
@@ -49,12 +49,29 @@ struct CDiskBlockPos
};
enum BlockStatus {
+ // Unused.
BLOCK_VALID_UNKNOWN = 0,
- BLOCK_VALID_HEADER = 1, // parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future
- BLOCK_VALID_TREE = 2, // parent found, difficulty matches, timestamp >= median previous, checkpoint
- BLOCK_VALID_TRANSACTIONS = 3, // only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids, sigops, size, merkle root
- BLOCK_VALID_CHAIN = 4, // outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30
- BLOCK_VALID_SCRIPTS = 5, // scripts/signatures ok
+
+ // Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future
+ BLOCK_VALID_HEADER = 1,
+
+ // All parent headers found, difficulty matches, timestamp >= median previous, checkpoint. Implies all parents
+ // are also at least TREE.
+ BLOCK_VALID_TREE = 2,
+
+ // Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids,
+ // sigops, size, merkle root. Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all
+ // parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set.
+ BLOCK_VALID_TRANSACTIONS = 3,
+
+ // Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30.
+ // Implies all parents are also at least CHAIN.
+ BLOCK_VALID_CHAIN = 4,
+
+ // Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
+ BLOCK_VALID_SCRIPTS = 5,
+
+ // All validity bits.
BLOCK_VALID_MASK = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS |
BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS,
@@ -103,7 +120,8 @@ public:
// Note: in a potential headers-first mode, this number cannot be relied upon
unsigned int nTx;
- // (memory only) Number of transactions in the chain up to and including this block
+ // (memory only) Number of transactions in the chain up to and including this block.
+ // This value will be non-zero only if and only if transactions for this block and all its parents are available.
unsigned int nChainTx; // change to 64-bit type when necessary; won't happen before 2030
// Verification status of this block. See enum BlockStatus
@@ -146,7 +164,7 @@ public:
SetNull();
}
- CBlockIndex(CBlockHeader& block)
+ CBlockIndex(const CBlockHeader& block)
{
SetNull();