Page MenuHomePhabricator

test: refactor: use `create_block` parameters
AcceptedPublic

Authored by PiRK on Mon, Feb 24, 16:26.

Details

Reviewers
roqqit
Group Reviewers
Restricted Project
Summary

Passing a list of transactions txlist to create_block appends
them to the block, hence we don't need to do that manually anymore.
The merkle root calculation can also be removed, since this is done
in the end of the helper.

This is a backport of core#23521
Notes:

  • We need to specify version=4 explicitly (missing backport: core#16333)
  • The txlist parameter to create_block is from core#19401, it was skipped in D10688 (because unused at the time).
  • We also move the tx ctor sorting code to create_block
Test Plan

ninja check-functional-extended

Diff Detail

Event Timeline

PiRK requested review of this revision.Mon, Feb 24, 16:26
test/functional/chronik_shutdown.py
52

previously it didn't hurt to shadow the outer loop counter because it was unused below, now we need i in the create_block call below

test/functional/p2p_invalid_block.py
116

here nValue is in XEC (BTC in the source material)

Failed tests logs:

====== Bitcoin ABC functional tests: abc_p2p_getavaaddr.py ======

------- Stdout: -------
2025-02-24T16:33:06.852000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250224_163303/abc_p2p_getavaaddr_4
2025-02-24T16:34:17.453000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        def test_function():
            if check_connected:
                assert self.is_connected
            return test_function_in()
'''
2025-02-24T16:34:17.453000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 149, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 139, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 554, in run_test
    self.getavaaddr_interval_test()
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 192, in getavaaddr_interval_test
    requester.wait_until(requester.addr_received)
  File "/work/test/functional/test_framework/p2p.py", line 582, in wait_until
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 296, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
        def test_function():
            if check_connected:
                assert self.is_connected
            return test_function_in()
''' not true after 60.0 seconds
2025-02-24T16:34:17.505000Z TestFramework (INFO): Stopping nodes
2025-02-24T16:34:17.606000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250224_163303/abc_p2p_getavaaddr_4
2025-02-24T16:34:17.606000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250224_163303/abc_p2p_getavaaddr_4/test_framework.log
2025-02-24T16:34:17.606000Z TestFramework (ERROR): 
2025-02-24T16:34:17.606000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250224_163303/abc_p2p_getavaaddr_4' to consolidate all logs
2025-02-24T16:34:17.606000Z TestFramework (ERROR): 
2025-02-24T16:34:17.607000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-02-24T16:34:17.607000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-02-24T16:34:17.607000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_p2p_getavaaddr.py

This revision is now accepted and ready to land.Mon, Feb 24, 17:37