MCPcopy Create free account
hub / github.com/ElementsProject/elements / run_test

Method run_test

test/functional/feature_pruning.py:369–482  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

367 self.log.info("Success")
368
369 def run_test(self):
370 self.log.info("Warning! This test requires 4GB of disk space")
371
372 self.log.info("Mining a big blockchain of 995 blocks")
373 self.create_big_chain()
374 # Chain diagram key:
375 # * blocks on main chain
376 # +,&,$,@ blocks on other forks
377 # X invalidated block
378 # N1 Node 1
379 #
380 # Start by mining a simple chain that all nodes have
381 # N0=N1=N2 **...*(995)
382
383 # stop manual-pruning node with 995 blocks
384 self.stop_node(3)
385 self.stop_node(4)
386
387 self.log.info("Check that we haven't started pruning yet because we're below PruneAfterHeight")
388 self.test_height_min()
389 # Extend this chain past the PruneAfterHeight
390 # N0=N1=N2 **...*(1020)
391
392 self.log.info("Check that we'll exceed disk space target if we have a very high stale block rate")
393 self.create_chain_with_staleblocks()
394 # Disconnect N0
395 # And mine a 24 block chain on N1 and a separate 25 block chain on N0
396 # N1=N2 **...*+...+(1044)
397 # N0 **...**...**(1045)
398 #
399 # reconnect nodes causing reorg on N1 and N2
400 # N1=N2 **...*(1020) *...**(1045)
401 # \
402 # +...+(1044)
403 #
404 # repeat this process until you have 12 stale forks hanging off the
405 # main chain on N1 and N2
406 # N0 *************************...***************************(1320)
407 #
408 # N1=N2 **...*(1020) *...**(1045) *.. ..**(1295) *...**(1320)
409 # \ \ \
410 # +...+(1044) &.. $...$(1319)
411
412 # Save some current chain state for later use
413 self.mainchainheight = self.nodes[2].getblockcount() # 1320
414 self.mainchainhash2 = self.nodes[2].getblockhash(self.mainchainheight)
415
416 self.log.info("Check that we can survive a 288 block reorg still")
417 self.reorg_test() # (1033, )
418 # Now create a 288 block reorg by mining a longer chain on N1
419 # First disconnect N1
420 # Then invalidate 1033 on main chain and 1032 on fork so height is 1032 on main chain
421 # N1 **...*(1020) **...**(1032)X..
422 # \
423 # ++...+(1031)X..
424 #
425 # Now mine 300 more blocks on N1
426 # N1 **...*(1020) **...**(1032) @@...@(1332)

Callers

nothing calls this directly

Calls 11

create_big_chainMethod · 0.95
test_height_minMethod · 0.95
reorg_testMethod · 0.95
reorg_backMethod · 0.95
manual_testMethod · 0.95
wallet_testMethod · 0.95
infoMethod · 0.80
stop_nodeMethod · 0.45
is_wallet_compiledMethod · 0.45

Tested by

no test coverage detected