September 24, 2026

p2p_dos_header_tree.py functional test failing

I am just getting started with Bitcoin and hoping to contribute in the near future. I am running into an issue with the p2p_dos_header_tree.py functional test. This might be an extremely stupid question so sorry in advance.

I am running bitcoin core on macOS Monterey 12.2.1

I’ve run the following commands:

  • https://github.com/bitcoin/bitcoin.git
  • cd bitcoin
  • contrib/install_db4.sh .
  • export BDB_PREFIX='/Volumes/bitcoin/bitcoin/db4'
  • ./autogen.sh
  • ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
  • make
  • make check (unit test passed successfully)

Then, I ran the functional test using the following command:

test/functional/test_runner.py --extended

and I get the following results:

TEST                                               | STATUS    | DURATION

example_test.py                                    | ✓ Passed  | 4 s
feature_abortnode.py                               | ✓ Passed  | 33 s
feature_addrman.py                                 | ✓ Passed  | 5 s
feature_anchors.py                                 | ✓ Passed  | 3 s
feature_asmap.py                                   | ✓ Passed  | 8 s
feature_assumevalid.py                             | ✓ Passed  | 40 s
feature_bip68_sequence.py                          | ✓ Passed  | 50 s
feature_block.py                                   | ✓ Passed  | 396 s
feature_blockfilterindex_prune.py                  | ✓ Passed  | 14 s
feature_blocksdir.py                               | ✓ Passed  | 2 s
feature_cltv.py                                    | ✓ Passed  | 3 s
feature_coinstatsindex.py --descriptors            | ✓ Passed  | 8 s
feature_coinstatsindex.py --legacy-wallet          | ✓ Passed  | 11 s
feature_config_args.py                             | ✓ Passed  | 17 s
feature_csv_activation.py                          | ✓ Passed  | 34 s
feature_dbcrash.py                                 | ✓ Passed  | 4043 s
feature_dersig.py                                  | ✓ Passed  | 3 s
feature_dirsymlinks.py                             | ✓ Passed  | 3 s
feature_fee_estimation.py                          | ✓ Passed  | 141 s
feature_filelock.py                                | ✓ Passed  | 3 s
feature_help.py                                    | ✓ Passed  | 1 s
feature_includeconf.py                             | ✓ Passed  | 3 s
feature_init.py                                    | ✓ Passed  | 26 s
feature_loadblock.py                               | ✓ Passed  | 3 s
feature_logging.py                                 | ✓ Passed  | 6 s
feature_maxtipage.py                               | ✓ Passed  | 7 s
feature_maxuploadtarget.py                         | ✓ Passed  | 110 s
feature_minchainwork.py                            | ✓ Passed  | 6 s
feature_notifications.py                           | ✓ Passed  | 12 s
feature_nulldummy.py --descriptors                 | ✓ Passed  | 2 s
feature_nulldummy.py --legacy-wallet               | ✓ Passed  | 4 s
feature_presegwit_node_upgrade.py                  | ✓ Passed  | 3 s
feature_proxy.py                                   | ✓ Passed  | 2 s
feature_pruning.py                                 | ✓ Passed  | 651 s
feature_rbf.py --descriptors                       | ✓ Passed  | 5 s
feature_rbf.py --legacy-wallet                     | ✓ Passed  | 6 s
feature_reindex.py                                 | ✓ Passed  | 5 s
feature_segwit.py --descriptors                    | ✓ Passed  | 32 s
feature_segwit.py --legacy-wallet                  | ✓ Passed  | 51 s
feature_settings.py                                | ✓ Passed  | 5 s
feature_shutdown.py                                | ✓ Passed  | 2 s
feature_signet.py                                  | ✓ Passed  | 5 s
feature_startupnotify.py                           | ✓ Passed  | 2 s
feature_taproot.py                                 | ✓ Passed  | 244 s
feature_uacomment.py                               | ✓ Passed  | 5 s
feature_utxo_set_hash.py                           | ✓ Passed  | 2 s
feature_versionbits_warning.py                     | ✓ Passed  | 10 s
interface_bitcoin_cli.py --descriptors             | ✓ Passed  | 13 s
interface_bitcoin_cli.py --legacy-wallet           | ✓ Passed  | 22 s
interface_http.py                                  | ✓ Passed  | 2 s
interface_rest.py                                  | ✓ Passed  | 6 s
interface_rpc.py                                   | ✓ Passed  | 3 s
interface_zmq.py                                   | ✓ Passed  | 40 s
mempool_accept.py                                  | ✓ Passed  | 15 s
mempool_accept_wtxid.py                            | ✓ Passed  | 16 s
mempool_expiry.py                                  | ✓ Passed  | 4 s
mempool_limit.py                                   | ✓ Passed  | 11 s
mempool_package_limits.py                          | ✓ Passed  | 12 s
mempool_package_onemore.py                         | ✓ Passed  | 83 s
mempool_packages.py                                | ✓ Passed  | 78 s
mempool_persist.py                                 | ✓ Passed  | 25 s
mempool_reorg.py                                   | ✓ Passed  | 5 s
mempool_resurrect.py                               | ✓ Passed  | 2 s
mempool_spend_coinbase.py                          | ✓ Passed  | 2 s
mempool_unbroadcast.py                             | ✓ Passed  | 16 s
mempool_updatefromblock.py                         | ✓ Passed  | 787 s
mining_basic.py                                    | ✓ Passed  | 10 s
mining_getblocktemplate_longpoll.py                | ✓ Passed  | 70 s
mining_prioritisetransaction.py                    | ✓ Passed  | 10 s
p2p_add_connections.py                             | ✓ Passed  | 8 s
p2p_addr_relay.py                                  | ✓ Passed  | 11 s
p2p_addrfetch.py                                   | ✓ Passed  | 2 s
p2p_addrv2_relay.py                                | ✓ Passed  | 2 s
p2p_blockfilters.py                                | ✓ Passed  | 33 s
p2p_blocksonly.py                                  | ✓ Passed  | 21 s
p2p_compactblocks.py                               | ✓ Passed  | 11 s
p2p_compactblocks_blocksonly.py                    | ✓ Passed  | 4 s
p2p_compactblocks_hb.py                            | ✓ Passed  | 15 s
p2p_disconnect_ban.py                              | ✓ Passed  | 2 s
p2p_dns_seeds.py                                   | ✓ Passed  | 34 s
p2p_eviction.py                                    | ✓ Passed  | 7 s
p2p_feefilter.py                                   | ✓ Passed  | 13 s
p2p_filter.py                                      | ✓ Passed  | 5 s
p2p_fingerprint.py                                 | ✓ Passed  | 2 s
p2p_getaddr_caching.py                             | ✓ Passed  | 16 s
p2p_getdata.py                                     | ✓ Passed  | 1 s
p2p_i2p_ports.py                                   | ✓ Passed  | 4 s
p2p_ibd_txrelay.py                                 | ✓ Passed  | 2 s
p2p_invalid_block.py                               | ✓ Passed  | 3 s
p2p_invalid_locator.py                             | ✓ Passed  | 4 s
p2p_invalid_messages.py                            | ✓ Passed  | 40 s
p2p_invalid_tx.py                                  | ✓ Passed  | 8 s
p2p_leak.py                                        | ✓ Passed  | 7 s
p2p_leak_tx.py                                     | ✓ Passed  | 4 s
p2p_message_capture.py                             | ✓ Passed  | 2 s
p2p_nobloomfilter_messages.py                      | ✓ Passed  | 2 s
p2p_node_network_limited.py                        | ✓ Passed  | 15 s
p2p_permissions.py                                 | ✓ Passed  | 16 s
p2p_ping.py                                        | ✓ Passed  | 2 s
p2p_segwit.py                                      | ✓ Passed  | 141 s
p2p_sendheaders.py                                 | ✓ Passed  | 21 s
p2p_timeouts.py                                    | ✓ Passed  | 2 s
p2p_tx_download.py                                 | ✓ Passed  | 33 s
p2p_unrequested_blocks.py                          | ✓ Passed  | 8 s
rpc_blockchain.py                                  | ✓ Passed  | 13 s
rpc_createmultisig.py --descriptors                | ✓ Passed  | 20 s
rpc_createmultisig.py --legacy-wallet              | ✓ Passed  | 40 s
rpc_decodescript.py                                | ✓ Passed  | 1 s
rpc_deprecated.py                                  | ✓ Passed  | 1 s
rpc_deriveaddresses.py                             | ✓ Passed  | 1 s
rpc_deriveaddresses.py --usecli                    | ✓ Passed  | 1 s
rpc_dumptxoutset.py                                | ✓ Passed  | 2 s
rpc_estimatefee.py                                 | ✓ Passed  | 1 s
rpc_fundrawtransaction.py --descriptors            | ✓ Passed  | 30 s
rpc_fundrawtransaction.py --legacy-wallet          | ✓ Passed  | 228 s
rpc_generate.py                                    | ✓ Passed  | 2 s
rpc_generateblock.py                               | ✓ Passed  | 2 s
rpc_getblockfilter.py                              | ✓ Passed  | 3 s
rpc_getblockfrompeer.py                            | ✓ Passed  | 2 s
rpc_getblockstats.py                               | ✓ Passed  | 2 s
rpc_getchaintips.py                                | ✓ Passed  | 6 s
rpc_getdescriptorinfo.py                           | ✓ Passed  | 1 s
rpc_help.py                                        | ✓ Passed  | 3 s
rpc_invalid_address_message.py                     | ✓ Passed  | 2 s
rpc_invalidateblock.py                             | ✓ Passed  | 2 s
rpc_mempool_entry_fee_fields_deprecation.py        | ✓ Passed  | 2 s
rpc_misc.py                                        | ✓ Passed  | 5 s
rpc_named_arguments.py                             | ✓ Passed  | 1 s
rpc_net.py                                         | ✓ Passed  | 25 s
rpc_packages.py                                    | ✓ Passed  | 11 s
rpc_preciousblock.py                               | ✓ Passed  | 3 s
rpc_psbt.py --descriptors                          | ✓ Passed  | 25 s
rpc_psbt.py --legacy-wallet                        | ✓ Passed  | 65 s
rpc_rawtransaction.py --descriptors                | ✓ Passed  | 11 s
rpc_rawtransaction.py --legacy-wallet              | ✓ Passed  | 26 s
rpc_scantxoutset.py                                | ✓ Passed  | 22 s
rpc_setban.py                                      | ✓ Passed  | 6 s
rpc_signmessagewithprivkey.py                      | ✓ Passed  | 1 s
rpc_signrawtransaction.py --descriptors            | ✓ Passed  | 6 s
rpc_signrawtransaction.py --legacy-wallet          | ✓ Passed  | 10 s
rpc_txoutproof.py                                  | ✓ Passed  | 4 s
rpc_uptime.py                                      | ✓ Passed  | 1 s
rpc_users.py                                       | ✓ Passed  | 7 s
rpc_whitelist.py                                   | ✓ Passed  | 1 s
tool_wallet.py --descriptors                       | ✓ Passed  | 20 s
tool_wallet.py --legacy-wallet                     | ✓ Passed  | 27 s
wallet_abandonconflict.py --descriptors            | ✓ Passed  | 10 s
wallet_abandonconflict.py --legacy-wallet          | ✓ Passed  | 24 s
wallet_address_types.py --descriptors              | ✓ Passed  | 26 s
wallet_address_types.py --legacy-wallet            | ✓ Passed  | 82 s
wallet_avoidreuse.py --descriptors                 | ✓ Passed  | 53 s
wallet_avoidreuse.py --legacy-wallet               | ✓ Passed  | 187 s
wallet_backup.py --descriptors                     | ✓ Passed  | 36 s
wallet_backup.py --legacy-wallet                   | ✓ Passed  | 92 s
wallet_balance.py --descriptors                    | ✓ Passed  | 13 s
wallet_balance.py --legacy-wallet                  | ✓ Passed  | 29 s
wallet_basic.py --descriptors                      | ✓ Passed  | 35 s
wallet_basic.py --legacy-wallet                    | ✓ Passed  | 63 s
wallet_bumpfee.py --descriptors                    | ✓ Passed  | 79 s
wallet_bumpfee.py --legacy-wallet                  | ✓ Passed  | 78 s
wallet_coinbase_category.py --descriptors          | ✓ Passed  | 2 s
wallet_coinbase_category.py --legacy-wallet        | ✓ Passed  | 4 s
wallet_create_tx.py --descriptors                  | ✓ Passed  | 15 s
wallet_create_tx.py --legacy-wallet                | ✓ Passed  | 92 s
wallet_createwallet.py --descriptors               | ✓ Passed  | 5 s
wallet_createwallet.py --legacy-wallet             | ✓ Passed  | 16 s
wallet_createwallet.py --usecli                    | ✓ Passed  | 18 s
wallet_descriptor.py --descriptors                 | ✓ Passed  | 7 s
wallet_disable.py --descriptors                    | ✓ Passed  | 1 s
wallet_disable.py --legacy-wallet                  | ✓ Passed  | 1 s
wallet_dump.py --legacy-wallet                     | ✓ Passed  | 34 s
wallet_encryption.py --descriptors                 | ✓ Passed  | 6 s
wallet_encryption.py --legacy-wallet               | ✓ Passed  | 8 s
wallet_fallbackfee.py --descriptors                | ✓ Passed  | 3 s
wallet_fallbackfee.py --legacy-wallet              | ✓ Passed  | 4 s
wallet_groups.py --descriptors                     | ✓ Passed  | 83 s
wallet_groups.py --legacy-wallet                   | ✓ Passed  | 100 s
wallet_hd.py --descriptors                         | ✓ Passed  | 16 s
wallet_hd.py --legacy-wallet                       | ✓ Passed  | 36 s
wallet_implicitsegwit.py --legacy-wallet           | ✓ Passed  | 18 s
wallet_import_rescan.py --legacy-wallet            | ✓ Passed  | 170 s
wallet_import_with_label.py --legacy-wallet        | ✓ Passed  | 7 s
wallet_importdescriptors.py --descriptors          | ✓ Passed  | 26 s
wallet_importmulti.py --legacy-wallet              | ✓ Passed  | 37 s
wallet_importprunedfunds.py --descriptors          | ✓ Passed  | 4 s
wallet_importprunedfunds.py --legacy-wallet        | ✓ Passed  | 7 s
wallet_keypool.py --descriptors                    | ✓ Passed  | 4 s
wallet_keypool.py --legacy-wallet                  | ✓ Passed  | 9 s
wallet_keypool_topup.py --descriptors              | ✓ Passed  | 21 s
wallet_keypool_topup.py --legacy-wallet            | ✓ Passed  | 120 s
wallet_labels.py --descriptors                     | ✓ Passed  | 3 s
wallet_labels.py --legacy-wallet                   | ✓ Passed  | 16 s
wallet_listdescriptors.py --descriptors            | ✓ Passed  | 3 s
wallet_listreceivedby.py --descriptors             | ✓ Passed  | 18 s
wallet_listreceivedby.py --legacy-wallet           | ✓ Passed  | 27 s
wallet_listsinceblock.py --descriptors             | ✓ Passed  | 18 s
wallet_listsinceblock.py --legacy-wallet           | ✓ Passed  | 24 s
wallet_listtransactions.py --descriptors           | ✓ Passed  | 20 s
wallet_listtransactions.py --legacy-wallet         | ✓ Passed  | 34 s
wallet_multisig_descriptor_psbt.py                 | ✓ Passed  | 5 s
wallet_multiwallet.py --descriptors                | ✓ Passed  | 45 s
wallet_multiwallet.py --legacy-wallet              | ✓ Passed  | 86 s
wallet_multiwallet.py --usecli                     | ✓ Passed  | 55 s
wallet_orphanedreward.py                           | ✓ Passed  | 9 s
wallet_reorgsrestore.py                            | ✓ Passed  | 11 s
wallet_resendwallettransactions.py --descriptors   | ✓ Passed  | 7 s
wallet_resendwallettransactions.py --legacy-wallet | ✓ Passed  | 8 s
wallet_send.py --descriptors                       | ✓ Passed  | 15 s
wallet_send.py --legacy-wallet                     | ✓ Passed  | 66 s
wallet_signmessagewithaddress.py                   | ✓ Passed  | 3 s
wallet_startup.py                                  | ✓ Passed  | 11 s
wallet_taproot.py                                  | ✓ Passed  | 137 s
wallet_timelock.py                                 | ✓ Passed  | 3 s
wallet_transactiontime_rescan.py --descriptors     | ✓ Passed  | 15 s
wallet_transactiontime_rescan.py --legacy-wallet   | ✓ Passed  | 16 s
wallet_txn_clone.py                                | ✓ Passed  | 10 s
wallet_txn_clone.py --mineblock                    | ✓ Passed  | 8 s
wallet_txn_clone.py --segwit                       | ✓ Passed  | 10 s
wallet_txn_doublespend.py --descriptors            | ✓ Passed  | 3 s
wallet_txn_doublespend.py --legacy-wallet          | ✓ Passed  | 6 s
wallet_txn_doublespend.py --mineblock              | ✓ Passed  | 11 s
wallet_watchonly.py --legacy-wallet                | ✓ Passed  | 7 s
wallet_watchonly.py --usecli --legacy-wallet       | ✓ Passed  | 8 s
feature_backwards_compatibility.py --descriptors   | ○ Skipped | 0 s
feature_backwards_compatibility.py --legacy-wallet | ○ Skipped | 0 s
feature_bind_extra.py                              | ○ Skipped | 1 s
feature_bind_port_discover.py                      | ○ Skipped | 0 s
feature_bind_port_externalip.py                    | ○ Skipped | 0 s
feature_syscall_sandbox.py                         | ○ Skipped | 0 s
feature_taproot.py --previous_release              | ○ Skipped | 0 s
feature_txindex_compatibility.py                   | ○ Skipped | 0 s
mempool_compatibility.py                           | ○ Skipped | 0 s
rpc_bind.py --ipv4                                 | ○ Skipped | 1 s
rpc_bind.py --ipv6                                 | ○ Skipped | 1 s
rpc_bind.py --nonloopback                          | ○ Skipped | 1 s
rpc_signer.py                                      | ○ Skipped | 0 s
wallet_inactive_hdchains.py                        | ○ Skipped | 1 s
wallet_signer.py --descriptors                     | ○ Skipped | 0 s
wallet_upgradewallet.py --legacy-wallet            | ○ Skipped | 1 s
p2p_dos_header_tree.py                             | ✖ Failed  | 60 s

ALL                                                | ✖ Failed  | 10871 s (accumulated) 
Runtime: 4043 s

The detailed failure message for p2p_dos_headee_tree.py is as follows:

206/240 - p2p_dos_header_tree.py failed, Duration: 60 s

stdout:
2022-03-08T13:05:28.229000Z TestFramework (INFO): Initializing test directory /var/folders/kk/b57przyd0kd3djthckzx3kpm0000gn/T/test_runner_₿_🏃_20220308_072916/p2p_dos_header_tree_38
2022-03-08T13:06:28.845000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        wait_until_helper(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
'''
2022-03-08T13:06:28.846000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 131, in main
    self.setup()
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 288, in setup
    self.setup_network()
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 398, in setup_network
    self.connect_nodes(i + 1, i)
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 584, in connect_nodes
    wait_until_helper(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/util.py", line 276, in wait_until_helper
    raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
AssertionError: Predicate ''''
        wait_until_helper(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
''' not true after 60.0 seconds
2022-03-08T13:06:28.900000Z TestFramework (INFO): Stopping nodes
[node 1] Cleaning up leftover process
[node 0] Cleaning up leftover process


stderr:
Traceback (most recent call last):
  File "/Volumes/bitcoin/bitcoin/test/functional/p2p_dos_header_tree.py", line 87, in <module>
    RejectLowDifficultyHeadersTest().main()
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 155, in main
    exit_code = self.shutdown()
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 304, in shutdown
    self.stop_nodes()
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 560, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/Volumes/bitcoin/bitcoin/test/functional/test_framework/test_node.py", line 350, in stop_node
    raise AssertionError("Unexpected stderr {} != {}".format(stderr, expected_stderr))
AssertionError: Unexpected stderr Error: Unable to bind to 127.0.0.1:11456 on this computer. Bitcoin Core is probably already running. != 

I’ve tried using --timeout-factor=1000 to rule out any potential timeout issues and --loglevel=debug to produce more detailed logs but when I looked at debug.log I didn’t see any helpful information (I might be missing something here)

When I run just the singular test with test/functional/test_runner.py p2p_dos_header_tree.py I get the following successful result:

TEST                   | STATUS    | DURATION

p2p_dos_header_tree.py | ✓ Passed  | 2 s

ALL                    | ✓ Passed  | 2 s (accumulated) 
Runtime: 2 s

Not sure what the discrepancy here is or if anyone has some insight into steps I might have missed or something I am incorrectly understanding

Previous Article

🆓Chiliz (CHZ) Mar-08 #CHZ $CHZ

Next Article

How to run Bitcoin Core and what folders to move to my second VM after having it successfully running on my first VM?