upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index 1b0be59..768f1c7 100644
--- a/src/main.h
+++ b/src/main.h
@@ -29,6 +29,10 @@ static const unsigned int MAX_ORPHAN_BLOCKS = 200;
29// so a block within the size limit could still hold millions of them and take 29// so a block within the size limit could still hold millions of them and take
30// the network minutes of CPU to reject. Same value Bitcoin settled on. 30// the network minutes of CPU to reject. Same value Bitcoin settled on.
31static const unsigned int MAX_BLOCK_SIGOPS = 20000; 31static const unsigned int MAX_BLOCK_SIGOPS = 20000;
32// Consensus block-size ceiling. MAX_SIZE is the serializer's generic safety
33// limit (32 MB), not a block rule. Bitcoin 0.1.0 predated the later 1 MB block
34// cap, so this tree inherited no real block-size consensus limit.
35static const unsigned int MAX_BLOCK_SIZE = 1000000;
32static const int64 COIN = 100000000; 36static const int64 COIN = 100000000;
33// Total Bitflash emission: identical to Bitcoin (21 million). 37// Total Bitflash emission: identical to Bitcoin (21 million).
34// MAX_MONEY guards against the value overflow bug (CVE-2010-5139), which in 38// MAX_MONEY guards against the value overflow bug (CVE-2010-5139), which in
@@ -1053,6 +1057,23 @@ public:
1053 return RandomXPoWHash((const void*)BEGIN(nVersion), END(nNonce) - BEGIN(nVersion)); 1057 return RandomXPoWHash((const void*)BEGIN(nVersion), END(nNonce) - BEGIN(nVersion));
1054 } 1058 }
1055 1059
1060 bool CheckSizeLimits() const
1061 {
1062 // The middle test compares a transaction *count* against a *byte*
1063 // limit. It is inherited from 0.1.0, where the same line compared
1064 // vtx.size() against MAX_SIZE, and it is inert: the smallest possible
1065 // transaction serializes to more than sixty bytes, so a block holding
1066 // over a million of them cannot also weigh under a megabyte.
1067 //
1068 // Kept rather than removed. This is consensus code, and a rewrite that
1069 // reads better is still a rewrite that can change what the network
1070 // accepts. Written down so the next reader does not have to derive it,
1071 // or "fix" it into something that does.
1072 return (!vtx.empty() &&
1073 vtx.size() <= MAX_BLOCK_SIZE &&
1074 ::GetSerializeSize(*this, SER_DISK) <= MAX_BLOCK_SIZE);
1075 }
1076
1056 1077
1057 uint256 BuildMerkleTree() const 1078 uint256 BuildMerkleTree() const
1058 { 1079 {