/ test / functional / feature_fastprune.py
feature_fastprune.py
 1  #!/usr/bin/env python3
 2  # Copyright (c) 2023 The Bitcoin Core developers
 3  # Distributed under the MIT software license, see the accompanying
 4  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
 5  """Test fastprune mode."""
 6  from test_framework.test_framework import BitcoinTestFramework
 7  from test_framework.util import (
 8      assert_equal
 9  )
10  from test_framework.wallet import MiniWallet
11  
12  
13  class FeatureFastpruneTest(BitcoinTestFramework):
14      def set_test_params(self):
15          self.num_nodes = 1
16          self.extra_args = [["-fastprune"]]
17  
18      def run_test(self):
19          self.log.info("ensure that large blocks don't crash or freeze in -fastprune")
20          wallet = MiniWallet(self.nodes[0])
21          tx = wallet.create_self_transfer()['tx']
22          annex = b"\x50" + b"\xff" * 0x10000
23          tx.wit.vtxinwit[0].scriptWitness.stack.append(annex)
24          self.generateblock(self.nodes[0], output="raw(55)", transactions=[tx.serialize().hex()])
25          assert_equal(self.nodes[0].getblockcount(), 201)
26  
27  
28  if __name__ == '__main__':
29      FeatureFastpruneTest(__file__).main()