Skip to content

Commit

Permalink
fix: activate dip0008 in feature_dip4_coinbasemerkleroots without ext…
Browse files Browse the repository at this point in the history
…ra blocks

It also remove custom helper
  • Loading branch information
knst committed Jan 17, 2025
1 parent 4f34567 commit 461b204
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
15 changes: 3 additions & 12 deletions test/functional/feature_dip4_coinbasemerkleroots.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,6 @@ def test_getmnlistdiff_base(self, baseBlockHash, blockHash):

return d

def activate_dip8(self, slow_mode=False):
# NOTE: set slow_mode=True if you are activating dip8 after a huge reorg
# or nodes might fail to catch up otherwise due to a large
# (MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16 blocks) reorg error.
self.log.info("Wait for dip0008 activation")
while self.nodes[0].getblockcount() < DIP0008_HEIGHT:
self.bump_mocktime(10)
self.generate(self.nodes[0], 10, sync_fun=self.no_op)
if slow_mode:
self.sync_blocks()
self.sync_blocks()

def test_dip8_quorum_merkle_root_activation(self, with_initial_quorum, slow_mode=False):
if with_initial_quorum:
Expand All @@ -279,7 +268,9 @@ def test_dip8_quorum_merkle_root_activation(self, with_initial_quorum, slow_mode
cbtx = self.nodes[0].getblock(self.nodes[0].getbestblockhash(), 2)["tx"][0]
assert cbtx["cbTx"]["version"] == 1

self.activate_dip8(slow_mode)
self.activate_by_name('dip0008', expected_activation_height=DIP0008_HEIGHT)
self.log.info("Mine one more block with new rules of dip0008")
self.generate(self.nodes[0], 1)

# Assert that merkleRootQuorums is present and 0 (we have no quorums yet)
cbtx = self.nodes[0].getblock(self.nodes[0].getbestblockhash(), 2)["tx"][0]
Expand Down
4 changes: 2 additions & 2 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ def set_dash_test_params(self, num_nodes, masterodes_count, extra_args=None, evo
self.quorum_data_request_expiration_timeout = 360


def activate_by_name(self, name, expected_activation_height=None):
def activate_by_name(self, name, expected_activation_height=None, slow_mode=True):
assert not softfork_active(self.nodes[0], name)
self.log.info("Wait for " + name + " activation")

Expand All @@ -1209,7 +1209,7 @@ def activate_by_name(self, name, expected_activation_height=None):
self.wait_for_sporks_same()

# mine blocks in batches
batch_size = 50
batch_size = 50 if not slow_mode else 10
if expected_activation_height is not None:
height = self.nodes[0].getblockcount()
assert height < expected_activation_height
Expand Down

0 comments on commit 461b204

Please sign in to comment.