From 91f213c4b8209d5a91bee592ea97ff883c4fe83d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 25 Jan 2019 16:54:42 -1100 Subject: [PATCH 1/3] +// --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 344224902..8c652350e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5220,7 +5220,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C AbortNode(state, "Failed to write block"); if (!ReceivedBlockTransactions(block, state, pindex, blockPos)) return error("AcceptBlock(): ReceivedBlockTransactions failed"); - if ( usetmp != 0 ) + if ( usetmp != 0 ) // not during initialdownload or if futureflag==0 and contextchecks ok pindex->nStatus |= BLOCK_IN_TMPFILE; } catch (const std::runtime_error& e) { return AbortNode(state, std::string("System error: ") + e.what()); From 352c93f2c4d58fd6bcb245fab1b3db67fd82868c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 25 Jan 2019 16:59:55 -1100 Subject: [PATCH 2/3] -<<<<< HEAD --- src/net.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/net.h b/src/net.h index b3df42df7..ff47737d8 100644 --- a/src/net.h +++ b/src/net.h @@ -64,11 +64,7 @@ static const unsigned int MAX_INV_SZ = 50000; /** The maximum number of new addresses to accumulate before announcing. */ static const unsigned int MAX_ADDR_TO_SEND = 1000; /** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */ -<<<<<<< HEAD static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = _MAX_BLOCK_SIZE; -======= -static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1024 * 1024; ->>>>>>> origin/FSM /** Maximum length of strSubVer in `version` message */ static const unsigned int MAX_SUBVERSION_LENGTH = 256; /** -listen default */ From 932b3582437021f3c52c101f2d72f406dca0bc36 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 25 Jan 2019 17:15:56 -1100 Subject: [PATCH 3/3] +comments how to update to 8MB blocks --- src/chainparams.cpp | 25 +++++++++++++++++++++++-- src/net.h | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index d01b9af1a..5c9efb276 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -225,11 +225,32 @@ void CChainParams::SetCheckpointData(CChainParams::CCheckpointData checkpointDat CChainParams::checkpointData = checkpointData; } -int32_t MAX_BLOCK_SIZE(int32_t height) // make sure to change MAX_PROTOCOL_MESSAGE_LENGTH also!!!! +/* + To change the max block size, all that needs to be updated is the #define _MAX_BLOCK_SIZE in utils.h + + However, doing that without any other changes will allow forking non-updated nodes by creating a larger block. So, make sure to height activate the new blocksize properly. + + Assuming it is 8MB, then: + #define _OLD_MAX_BLOCK_SIZE (4096 * 1024) + #define _MAX_BLOCK_SIZE (2 * 4096 * 1024) + + change the body of if: + { + if ( height < saplinght+1000000 ) // activates 8MB blocks 1 million blocks after saplinght + return(_OLD_MAX_BLOCK_SIZE); + else return(_MAX_BLOCK_SIZE); + } + +*/ + +int32_t MAX_BLOCK_SIZE(int32_t height) { + int32_t saplinght = mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight; //fprintf(stderr,"MAX_BLOCK_SIZE %d vs. %d\n",height,mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight); - if ( height <= 0 || (mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight > 0 && height >= mainParams.consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight) ) + if ( height <= 0 || (saplinght > 0 && height >= saplinght) ) + { return(_MAX_BLOCK_SIZE); + } else return(2000000); } diff --git a/src/net.h b/src/net.h index ff47737d8..3e06e9831 100644 --- a/src/net.h +++ b/src/net.h @@ -64,7 +64,7 @@ static const unsigned int MAX_INV_SZ = 50000; /** The maximum number of new addresses to accumulate before announcing. */ static const unsigned int MAX_ADDR_TO_SEND = 1000; /** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */ -static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = _MAX_BLOCK_SIZE; +static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = (_MAX_BLOCK_SIZE + 24); // 24 is msgheader size /** Maximum length of strSubVer in `version` message */ static const unsigned int MAX_SUBVERSION_LENGTH = 256; /** -listen default */