Page MenuHomePhabricator

D423.id1050.diff
No OneTemporary

D423.id1050.diff

diff --git a/qa/rpc-tests/abc-cmdline.py b/qa/rpc-tests/abc-cmdline.py
--- a/qa/rpc-tests/abc-cmdline.py
+++ b/qa/rpc-tests/abc-cmdline.py
@@ -95,49 +95,6 @@
raise AssertionError('Must not accept excessiveblocksize'
' below blockmaxsize')
- # Make sure that allowsmallgeneratedblocksize doesn't help here
- outputchecker = OutputChecker()
- try:
- self.extra_args = [['-blockmaxsize=1500000',
- '-excessiveblocksize=1300000',
- '-allowsmallgeneratedblocksize']]
- self.nodes[0] = start_node(0, self.options.tmpdir,
- self.extra_args[0],
- stderr_checker=outputchecker)
- except Exception as e:
- assert(outputchecker.contains(
- 'Error: ' + MAX_GENERATED_BLOCK_SIZE_ERROR))
- assert_equal(
- 'bitcoind exited with status 1 during initialization', str(e))
- else:
- raise AssertionError('Must not accept excessiveblocksize'
- ' below blockmaxsize')
-
- print(" Attempt to set blockmaxsize below 1MB")
- outputchecker = OutputChecker()
- try:
- self.extra_args = [["-blockmaxsize=%d" % LEGACY_MAX_BLOCK_SIZE]]
- self.nodes[0] = start_node(0, self.options.tmpdir,
- self.extra_args[0],
- stderr_checker=outputchecker)
- except Exception as e:
- assert(outputchecker.contains(
- 'Error: ' + MAX_GENERATED_BLOCK_SIZE_ERROR))
- assert_equal(
- 'bitcoind exited with status 1 during initialization', str(e))
- else:
- raise AssertionError('Must not accept excessiveblocksize'
- ' below blockmaxsize')
-
- outputchecker = OutputChecker()
- self.extra_args = [["-blockmaxsize=%d" % LEGACY_MAX_BLOCK_SIZE,
- "-allowsmallgeneratedblocksize"]]
- self.nodes[0] = start_node(0, self.options.tmpdir,
- self.extra_args[0],
- stderr_checker=outputchecker)
- assert(outputchecker.contains(
- 'Warning: ' + MAX_GENERATED_BLOCK_SIZE_ERROR))
-
def run_test(self):
# Run tests on -excessiveblocksize option
self.excessiveblocksize_test()
diff --git a/qa/rpc-tests/pruning.py b/qa/rpc-tests/pruning.py
--- a/qa/rpc-tests/pruning.py
+++ b/qa/rpc-tests/pruning.py
@@ -183,7 +183,6 @@
self.stop_node(1)
self.nodes[1] = start_node(1, self.options.tmpdir, ["-debug",
"-maxreceivebuffer=20000",
- "-allowsmallgeneratedblocksize",
"-blockmaxsize=5000",
"-checkblocks=5",
"-disablesafemode",
@@ -214,7 +213,6 @@
self.stop_node(1)
self.nodes[1] = start_node(1, self.options.tmpdir, ["-debug",
"-maxreceivebuffer=20000",
- "-allowsmallgeneratedblocksize",
"-blockmaxsize=5000",
"-checkblocks=5",
"-disablesafemode",
diff --git a/qa/rpc-tests/smartfees.py b/qa/rpc-tests/smartfees.py
--- a/qa/rpc-tests/smartfees.py
+++ b/qa/rpc-tests/smartfees.py
@@ -212,8 +212,7 @@
# (17k is room enough for 110 or so transactions)
self.nodes.append(start_node(1, self.options.tmpdir,
["-blockprioritysize=1500", "-blockmaxsize=17000",
- "-maxorphantx=1000", "-debug=estimatefee",
- "-allowsmallgeneratedblocksize"],
+ "-maxorphantx=1000", "-debug=estimatefee"],
stderr_checker=OutputChecker()))
connect_nodes(self.nodes[1], 0)
@@ -221,8 +220,7 @@
# produces too small blocks (room for only 55 or so transactions)
node2args = ["-blockprioritysize=0",
"-blockmaxsize=8000",
- "-maxorphantx=1000",
- "-allowsmallgeneratedblocksize"]
+ "-maxorphantx=1000"]
self.nodes.append(
start_node(2, self.options.tmpdir, node2args, stderr_checker=OutputChecker()))
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1404,20 +1404,10 @@
// satisfy the "must be big" UAHF rule.
const uint64_t nProposedMaxGeneratedBlockSize =
GetArg("-blockmaxsize", DEFAULT_MAX_GENERATED_BLOCK_SIZE);
- const bool maxGeneratedBlockSizeTooSmall =
- nProposedMaxGeneratedBlockSize <= LEGACY_MAX_BLOCK_SIZE;
- const bool maxGeneratedBlockSizeTooBig =
- nProposedMaxGeneratedBlockSize > config.GetMaxBlockSize();
- if (maxGeneratedBlockSizeTooSmall || maxGeneratedBlockSizeTooBig) {
- auto msg =
- _("Max generated block size (blockmaxsize) cannot be lower than "
- "1MB or exceed the excessive block size (excessiveblocksize)");
- if (maxGeneratedBlockSizeTooBig ||
- !IsArgSet("-allowsmallgeneratedblocksize")) {
- return InitError(msg);
- }
-
- InitWarning(msg);
+ if (nProposedMaxGeneratedBlockSize > config.GetMaxBlockSize()) {
+ auto msg = _("Max generated block size (blockmaxsize) cannot exceed "
+ "the excessive block size (excessiveblocksize)");
+ return InitError(msg);
}
const int64_t nProposedUAHFStartTime =
diff --git a/src/miner.cpp b/src/miner.cpp
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -96,26 +96,9 @@
std::max(uint64_t(1000), std::min(config.GetMaxBlockSize() - 1000,
nMaxGeneratedBlockSize));
- // If UAHF is not activated yet, we also want to limit the max generated
- // block size to LEGACY_MAX_BLOCK_SIZE - 1000
- if (!IsUAHFenabled(config, pindexPrev)) {
- nMaxGeneratedBlockSize =
- std::min(LEGACY_MAX_BLOCK_SIZE - 1000, nMaxGeneratedBlockSize);
- }
-
return nMaxGeneratedBlockSize;
}
-static uint64_t ComputeMinGeneratedBlockSize(const Config &config,
- const CBlockIndex *pindexPrev) {
- if (IsUAHFenabled(config, pindexPrev) &&
- !IsUAHFenabled(config, pindexPrev->pprev)) {
- return LEGACY_MAX_BLOCK_SIZE + 1;
- }
-
- return 0;
-}
-
BlockAssembler::BlockAssembler(const Config &_config,
const CChainParams &_chainparams)
: chainparams(_chainparams), config(&_config) {
@@ -162,7 +145,6 @@
resetBlock();
pblocktemplate.reset(new CBlockTemplate());
-
if (!pblocktemplate.get()) {
return nullptr;
}
@@ -223,30 +205,6 @@
uint64_t nSerializeSize =
GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION);
- // We need a "must be big" block, so we stuff the coinbase.
- uint64_t nMinBlockSize = ComputeMinGeneratedBlockSize(*config, pindexPrev);
- if (nSerializeSize < nMinBlockSize) {
- static const std::string pad =
- "A purely peer-to-peer version of electronic cash would allow "
- "online payments to be sent directly from one party to another "
- "without going through a financial institution.";
- auto o = CTxOut(
- 0, CScript() << OP_RETURN
- << std::vector<unsigned char>(pad.begin(), pad.end()));
- auto commitmentSize =
- GetSerializeSize(o, SER_NETWORK, PROTOCOL_VERSION);
- auto missingCommitment =
- 1 + ((nMinBlockSize - nSerializeSize - 1) / commitmentSize);
- coinbaseTx.vout.reserve(missingCommitment + 1);
- for (size_t i = 0; i < missingCommitment; ++i) {
- coinbaseTx.vout.push_back(o);
- }
-
- pblock->vtx[0] = MakeTransactionRef(coinbaseTx);
- nSerializeSize =
- GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION);
- }
-
LogPrintf("CreateNewBlock(): total size: %u txs: %u fees: %ld sigops %d\n",
nSerializeSize, nBlockTx, nFees, nBlockSigOps);
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -727,36 +727,6 @@
// We are working on a fake chain and need to protect ourselves.
LOCK(cs_main);
- // Check before UAHF activation.
- BOOST_CHECK(!IsUAHFenabledForCurrentBlock(config));
-
- // Test around the historical 1MB cap
- config.SetMaxBlockSize(ONE_MEGABYTE);
- CheckBlockMaxSize(chainparams, 0, 1000);
- CheckBlockMaxSize(chainparams, 1000, 1000);
- CheckBlockMaxSize(chainparams, 1001, 1001);
- CheckBlockMaxSize(chainparams, 12345, 12345);
-
- CheckBlockMaxSize(chainparams, ONE_MEGABYTE - 1001, ONE_MEGABYTE - 1001);
- CheckBlockMaxSize(chainparams, ONE_MEGABYTE - 1000, ONE_MEGABYTE - 1000);
- CheckBlockMaxSize(chainparams, ONE_MEGABYTE - 999, LEGACY_CAP);
- CheckBlockMaxSize(chainparams, ONE_MEGABYTE, LEGACY_CAP);
-
- // Test around higher limit, the block size should still cap at LEGACY_CAP.
- static const auto EIGHT_MEGABYTES = 8 * ONE_MEGABYTE;
- config.SetMaxBlockSize(EIGHT_MEGABYTES);
- CheckBlockMaxSize(chainparams, EIGHT_MEGABYTES - 1001, LEGACY_CAP);
- CheckBlockMaxSize(chainparams, EIGHT_MEGABYTES - 1000, LEGACY_CAP);
- CheckBlockMaxSize(chainparams, EIGHT_MEGABYTES - 999, LEGACY_CAP);
- CheckBlockMaxSize(chainparams, EIGHT_MEGABYTES, LEGACY_CAP);
-
- // Before the UAHF, the default generated block size is the LEGACY_CAP.
- {
- ClearArg("-blockmaxsize");
- BlockAssembler ba(config, chainparams);
- BOOST_CHECK_EQUAL(ba.GetMaxGeneratedBlockSize(), LEGACY_CAP);
- }
-
// Activate UAHF
const int64_t hfStartTime = config.GetUAHFStartTime();
auto pindex = chainActive.Tip();
@@ -780,6 +750,7 @@
CheckBlockMaxSize(chainparams, ONE_MEGABYTE, ONE_MEGABYTE - 999);
// Test around higher limit such as 8MB
+ static const auto EIGHT_MEGABYTES = 8 * ONE_MEGABYTE;
config.SetMaxBlockSize(EIGHT_MEGABYTES);
CheckBlockMaxSize(chainparams, EIGHT_MEGABYTES - 1001,
EIGHT_MEGABYTES - 1001);

File Metadata

Mime Type
text/plain
Expires
Mon, May 12, 01:46 (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5777064
Default Alt Text
D423.id1050.diff (10 KB)

Event Timeline