diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index 784e9d0e90..b7cd28b1ee 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -11,6 +11,7 @@ import re import os import os.path +import sha3 import sys import hashlib import datetime @@ -20,8 +21,9 @@ settings = {} def calc_hash_str(blk_hdr): - blk_hdr_hash = hashlib.sha256(hashlib.sha256(blk_hdr).digest()).digest() - return blk_hdr_hash[::-1].hex() + blk_hdr_hash = sha3.keccak_256() + blk_hdr_hash.update(blk_hdr) + return blk_hdr_hash.digest()[::-1].hex() def get_blk_dt(blk_hdr): members = struct.unpack(" inputs") self.move_tip(57) b59 = self.next_block(59) - tx = self.create_and_sign_transaction(out[17], 51 * COIN) + tx = self.create_and_sign_transaction(out[17], 201 * COIN) b59 = self.update_block(59, [tx]) self.send_blocks([b59], success=False, reject_reason='bad-txns-in-belowout', reconnect=True) diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index d820c7814a..8ed3700b29 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -31,7 +31,7 @@ def test_config_file_parser(self): self.log.info('Test config file parser') self.stop_node(0) - # Check that startup fails if conf= is set in bitcoin.conf or in an included conf file + # Check that startup fails if conf= is set in BGL.conf or in an included conf file bad_conf_file_path = self.nodes[0].datadir_path / "BGL_bad.conf" util.write_config(bad_conf_file_path, n=0, chain='', extra_config=f'conf=some.conf\n') conf_in_config_file_err = 'Error: Error reading configuration file: conf cannot be set in the configuration file; use includeconf= if you want to include additional config files' @@ -123,11 +123,11 @@ def test_config_file_log(self): self.log.info('Test that correct configuration path is changed when configuration file changes the datadir') # Create a temporary directory that will be treated as the default data - # directory by bitcoind. + # directory by BGL. env, default_datadir = util.get_temp_default_datadir(pathlib.Path(self.options.tmpdir, "test_config_file_log")) default_datadir.mkdir(parents=True) - # Write a bitcoin.conf file in the default data directory containing a + # Write a BGL.conf file in the default data directory containing a # datadir= line pointing at the node datadir. node = self.nodes[0] conf_text = pathlib.Path(node.BGLconf).read_text() @@ -354,10 +354,10 @@ def test_ignored_default_conf(self): env, default_datadir = util.get_temp_default_datadir(pathlib.Path(self.options.tmpdir, "home")) default_datadir.mkdir(parents=True) - # Write a bitcoin.conf file in the default data directory containing a + # Write a BGL.conf file in the default data directory containing a # datadir= line pointing at the node datadir. This will trigger a # startup error because the node datadir contains a different - # bitcoin.conf that would be ignored. + # BGL.conf that would be ignored. node = self.nodes[0] (default_datadir / "BGL.conf").write_text(f"datadir={node.datadir}\n") @@ -374,7 +374,7 @@ def test_ignored_default_conf(self): def test_acceptstalefeeestimates_arg_support(self): self.log.info("Test -acceptstalefeeestimates option support") - conf_file = self.nodes[0].datadir_path / "bitcoin.conf" + conf_file = self.nodes[0].datadir_path / "BGL.conf" for chain, chain_name in {("main", ""), ("test", "testnet3"), ("signet", "signet")}: util.write_config(conf_file, n=0, chain=chain_name, extra_config='acceptstalefeeestimates=1\n') self.nodes[0].assert_start_raises_init_error(expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.') diff --git a/test/functional/feature_loadblock.py b/test/functional/feature_loadblock.py index 1eafcbe633..d2e2ea4c77 100755 --- a/test/functional/feature_loadblock.py +++ b/test/functional/feature_loadblock.py @@ -52,7 +52,7 @@ def run_test(self): cfg.write(f"host={node_url.hostname}\n") cfg.write(f"output_file={bootstrap_file}\n") cfg.write(f"max_height=100\n") - cfg.write(f"netmagic=fabfb5da\n") + cfg.write(f"netmagic=d98cbfba\n") cfg.write(f"input={blocks_dir}\n") cfg.write(f"genesis={genesis_block}\n") cfg.write(f"hashlist={hash_list.name}\n") diff --git a/test/functional/feature_maxuploadtarget.py b/test/functional/feature_maxuploadtarget.py index d9242c1109..c114e2e564 100755 --- a/test/functional/feature_maxuploadtarget.py +++ b/test/functional/feature_maxuploadtarget.py @@ -94,12 +94,12 @@ def run_test(self): getdata_request.inv.append(CInv(MSG_BLOCK, big_old_block)) max_bytes_per_day = 800*1024*1024 - daily_buffer = 144 * 4000000 + daily_buffer = 144 * 400000 max_bytes_available = max_bytes_per_day - daily_buffer success_count = max_bytes_available // old_block_size # 576MB will be reserved for relaying new blocks, so expect this to - # succeed for ~235 tries. + # succeed for ~8120 tries. for i in range(success_count): p2p_conns[0].send_and_ping(getdata_request) assert_equal(p2p_conns[0].block_receive_map[big_old_block], i+1) @@ -107,7 +107,7 @@ def run_test(self): assert_equal(len(self.nodes[0].getpeerinfo()), 3) # At most a couple more tries should succeed (depending on how long # the test has been running so far). - for _ in range(3): + for _ in range(100): p2p_conns[0].send_message(getdata_request) p2p_conns[0].wait_for_disconnect() assert_equal(len(self.nodes[0].getpeerinfo()), 2) diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py index c1dfc36e53..1339603332 100755 --- a/test/functional/feature_taproot.py +++ b/test/functional/feature_taproot.py @@ -1738,7 +1738,7 @@ def pr(node): aux = tx_test.setdefault("auxiliary", {}) aux['fullySignedTx'] = tx.serialize().hex() keypath_tests.append(tx_test) - assert_equal(hashlib.sha256(tx.serialize()).hexdigest(), "31bd332c65d7cc5303377b84db007e4d6a27942a52546fb03377496448426d7a") + assert_equal(hashlib.sha256(tx.serialize()).hexdigest(), "9edad9338a58341384422264bd17b7597cd22be06a458cb6cae5ed72ecb9fc3f") # Mine the spending transaction #self.block_submit(self.nodes[0], [tx], "Spending txn", None, sigops_weight=10000, accept=True, witness=True) diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 8b54015616..9652247000 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -125,7 +125,7 @@ def script_BIP34_coinbase_height(height): return CScript([CScriptNum(height)]) -def create_coinbase(height, pubkey=None, *, script_pubkey=None, extra_output_script=None, fees=0, nValue=50): +def create_coinbase(height, pubkey=None, *, script_pubkey=None, extra_output_script=None, fees=0, nValue=200): """Create a coinbase transaction. If pubkey is passed in, the coinbase output will be a P2PK output; diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py index 23fc47f17f..98e9d4091a 100644 --- a/test/functional/test_framework/script.py +++ b/test/functional/test_framework/script.py @@ -689,7 +689,7 @@ def LegacySignatureHash(*args, **kwargs): if msg is None: return (HASH_ONE, err) else: - return (hash256(msg), err) + return (keccak256(msg), err) def sign_input_legacy(tx, input_index, input_scriptpubkey, privkey, sighash_type=SIGHASH_ALL): """Add legacy ECDSA signature for a given transaction input. Note that the signature @@ -746,7 +746,7 @@ def SegwitV0SignatureMsg(script, txTo, inIdx, hashtype, amount): return ss def SegwitV0SignatureHash(*args, **kwargs): - return hash256(SegwitV0SignatureMsg(*args, **kwargs)) + return keccak256(SegwitV0SignatureMsg(*args, **kwargs)) class TestFrameworkScript(unittest.TestCase): def test_bn2vch(self): @@ -777,19 +777,19 @@ def test_cscriptnum_encoding(self): self.assertEqual(CScriptNum.decode(CScriptNum.encode(CScriptNum(value))), value) def BIP341_sha_prevouts(txTo): - return sha256(b"".join(i.prevout.serialize() for i in txTo.vin)) + return keccak256(b"".join(i.prevout.serialize() for i in txTo.vin)) def BIP341_sha_amounts(spent_utxos): - return sha256(b"".join(struct.pack("