aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2019-07-25 14:37:53 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2019-07-25 14:43:30 -0400
commitbf3be5297a746982cf8e83f45d342121e5665f80 (patch)
treed47d672cbe12fc302ee38c7127df1350a8b99714 /test
parentfcc4025c1255bec81eb724c6af289fec25ac03a2 (diff)
downloadbitcoin-bf3be5297a746982cf8e83f45d342121e5665f80.tar.xz
[qa] Ensure we don't generate a too-big block in p2sh sigops test
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_block.py8
1 files changed, 8 insertions, 0 deletions
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()