Permalink
Browse files

Trivially map blockmaxsize to blockmaxweight while segwit is unactivated

  • Loading branch information...
1 parent 114f7e9 commit 5a716a3bc6621e4d2e2c1de5b6b5596d6877d589 @luke-jr luke-jr committed Aug 9, 2016
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/miner.cpp
View
@@ -141,6 +141,13 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
CBlockIndex* pindexPrev = chainActive.Tip();
nHeight = pindexPrev->nHeight + 1;
+ if (fNeedSizeAccounting && !IsWitnessEnabled(pindexPrev, chainparams.GetConsensus())) {
+ // Just translate to nBlockMaxWeight
+ nBlockMaxWeight = min(nBlockMaxSize * WITNESS_SCALE_FACTOR, nBlockMaxWeight);
+ nBlockMaxSize = MAX_BLOCK_SERIALIZED_SIZE-1000;
+ fNeedSizeAccounting = false;
+ }
+
pblock->nVersion = ComputeBlockVersion(pindexPrev, chainparams.GetConsensus());
// -regtest only: allow overriding block.nVersion with
// -blockversion=N to test forking scenarios

1 comment on commit 5a716a3

@rebroad

what is the impact of this change?

Please sign in to comment.