-
Notifications
You must be signed in to change notification settings - Fork 37.7k
BLOCKING: Consensus: Move blocksize and related parameters to consensusparams ...without removing consensus/consensus.h [#6526 alternative] #6625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In summary, this doesn't destroy consensus/consensus.h (doesn't undo costly refactor work #5970), this doesn't s/Params().GetConsensus()/consensusParams/ when it's not necessary (because the function depends on CChainParams, see #XXXX), and it goes further in relation to facilitate implementations of consensus block size changes by creating MaxBlockSize() and MaxBlockSigops() (which is diff-free when you're replacing MAX_BLOCK_SIZE with consensusParams.nMaxBlockSize anyway). |
989e374
to
4a96d92
Compare
Force pushed with a fix in |
if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) | ||
uint64_t nMaxBlockSize = MaxBlockSize(consensusParams); | ||
uint64_t nMaxBlockSigops = MaxBlockSigops(consensusParams); | ||
uint64_t nMaxTxSize = consensusParams.nMaxTxSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this pulled out as a variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason, ask @theuni
utACK |
Added a squashme commit that should solve @dcousens' nits (ie |
820c84c
to
0cac6d2
Compare
Updated with the squashed version. |
Closing in favor of #6672. |
0cac6d2
to
dc23326
Compare
Rebased and reopened. |
re-ACK, but the constant shifting of code to different [but almost the same] PRs is getting insane. |
@@ -484,7 +486,7 @@ void CTxMemPool::removeCoinbaseSpends(const CCoinsViewCache *pcoins, unsigned in | |||
continue; | |||
const CCoins *coins = pcoins->AccessCoins(txin.prevout.hash); | |||
if (fSanityCheck) assert(coins); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dc23326
to
f45ede4
Compare
@MarcoFalke Thanks, rebased. |
New uses of MAX_BLOCK_SIZE/MaxBlockSize() were introduced in #6622. |
a2f24e0
to
b89e8bb
Compare
Rebased with a tiny fix that would have break the build (if this has been merged without the fix). |
Great, I was thinking about leaving CheckTransaction/Consensus::CheckTx declared in main.h if we were going for the 2/3 commits option and that was a problem. |
I agree with @sipa, it doesn't look too disruptive as-is. |
20ceb05
to
82b2443
Compare
Needed trivial rebase. |
utACK 82b2443 |
utACK |
Rebased(6) |
e9a9115
to
e66e102
Compare
Re-ACK, @laanwj anything holding this back? |
e66e102
to
4334ace
Compare
Rebased(7) |
…tion number This is a no-op change. For now, everything passes MAX_BLOCK_SIZE / 60, so the result matches what it would've before. Tests use a number equal to the number of transactions where necessary, to ensure that they're never rejected when blocksizesize isn't being tested.
This is a no-op change. Tests use a value of std::numeric_limits<uint64_t>::max() where necessary, to ensure that they're never rejected when size isn't being tested.
…sus.h (as functions) The following are now tied to a chain rather than being defined as global constants. Their values have not changed. nMinTxSize nMaxBlockSize nMaxTxSize nMaxBlockSigops nCoinbaseMaturity Also, for free (diff-wise): Blocksize: Turn MAX_BLOCK_SIZE (nMaxBlockSize) and MAX_BLOCK_SIGOPS (nMaxBlockSigops) into functions ...which take Consensus::Params as parameter This will be convenient to reduce the diff of any proposal that changes the blocksize as a hardfork
4334ace
to
6111e5b
Compare
This would make it much easier to maintain those ready "patches" (even the simple bip102 has rapidly bitrot). If ithad been merged for 0.12 like was supposed to be the plan (according to sipa and btcdrak comments), that would have also make those pat hes easier to backport to 0.12. |
This was ACK'd for |
Yes, if this get's merged in master, at least the first three commits should be |
ACK |
Structure seems reasonable, with the caveat that MaxBlockSize() and MaxBlockSigOps() will inevitably be modified depending on what state they examine. |
Yeah, when I changed the variable in the Consensus::Params struct (what @cfields had initially) to a function I wasn't sure on whether to use block.nHeight or header.mediaTime(), certainly not header.nTime. If we can finally agree on that somewhere I don't mind to change it. |
ut ACK, for the record |
Replaced by #7238 (a subset of this) with @rustyrussell 's nit fixed. |
This is a replacement for #6526 with my nits integrated in the commits where they were more relevant.
It has a smaller diff (138 additions and 65 deletions VS +116 −95) is more amenable to any block size change proposal (many of them will need a function), to #6382 (adding new test chains for block size tests) and to libconsenusus-related #6591 (which is also part of the process of making chainparams less global #5970).
I will rebase #6382, #6591 and #5970 on top of this. Please, @theuni close #6526 in favor of this if it passes your review.
Blocking: