#!/usr/bin/env python3 # Copyright (c) 2023 The Dash Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import struct from io import BytesIO from test_framework.authproxy import JSONRPCException from test_framework.key import ECKey from test_framework.messages import ( CMnEhf, CTransaction, hash256, ser_string, ) from test_framework.test_framework import DashTestFramework from test_framework.util import ( assert_equal, assert_greater_than, get_bip9_details, ) class MnehfTest(DashTestFramework): def set_test_params(self): extra_args = [["-vbparams=testdummy:0:999999999999:12:12:12:5:0"] for _ in range(4)] self.set_dash_test_params(4, 3, fast_dip3_enforcement=True, extra_args=extra_args) def skip_test_if_missing_module(self): self.skip_if_no_wallet() def restart_all_nodes(self): for inode in range(self.num_nodes): self.log.info(f"Restart node {inode} with {self.extra_args[inode]}") self.restart_node(inode, self.extra_args[inode]) for i in range(self.num_nodes - 1): self.connect_nodes(i + 1, i) def create_mnehf(self, versionBit, pubkey=None): # request ID = sha256("mnhf", versionBit) request_id_buf = ser_string(b"mnhf") + struct.pack("