From bf3be5297a746982cf8e83f45d342121e5665f80 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Thu, 25 Jul 2019 14:37:53 -0400 Subject: [PATCH] [qa] Ensure we don't generate a too-big block in p2sh sigops test --- test/functional/feature_block.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py index b5eac88ba7..fdb608d457 100755 --- a/test/functional/feature_block.py +++ b/test/functional/feature_block.py @@ -486,6 +486,14 @@ class FullBlockTest(BitcoinTestFramework): tx_last = tx_new b39_outputs += 1 + # The accounting in the loop above can be off, because it misses the + # compact size encoding of the number of transactions in the block. + # Make sure we didn't accidentally make too big a block. Note that the + # size of the block has non-determinism due to the ECDSA signature in + # the first transaction. + while (len(b39.serialize()) >= MAX_BLOCK_BASE_SIZE): + del b39.vtx[-1] + b39 = self.update_block(39, []) self.send_blocks([b39], True) self.save_spendable_output()