Page MenuHomePhabricator

validation: add chainman ref to CChainState
ClosedPublic

Authored by PiRK on Oct 17 2022, 14:48.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC7db9e191cda0: validation: add chainman ref to CChainState
Summary

Add an upwards reference to chainstate instances to the owning
ChainstateManager. This is necessary because there are a number
of this_chainstate == chainman.ActiveChainstate() checks that
will happen (as a result of assumeutxo) in functions that otherwise
don't have an easily-accessible reference to the chainstate's
ChainManager.

This is a backport of core#21526 [1/12]
https://github.com/bitcoin/bitcoin/pull/21526/commits/9f6bb539359b98d5b39482ab8a28a68608f0c645

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Oct 17 2022, 14:48

Failed tests logs:

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

------- Stdout: -------
2022-10-17T15:16:37.563000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20221017_151556/abc_p2p_compactproofs_10
2022-10-17T15:16:38.278000Z TestFramework (INFO): Check we send a getavaproofs message to our avalanche outbound peers
2022-10-17T15:16:40.192000Z TestFramework (INFO): Check we send periodic getavaproofs message to some of our peers
2022-10-17T15:16:40.243000Z TestFramework (INFO): After the first avaproofs has been received, all the peers are requested periodically
2022-10-17T15:16:40.613000Z TestFramework (INFO): Empty avaproofs will not trigger any request
2022-10-17T15:16:40.614000Z TestFramework (INFO): Check we send a getavaproofs message to our manually connected peers that support avalanche
2022-10-17T15:16:41.889000Z TestFramework (INFO): Check the node responds to getavaproofs messages
2022-10-17T15:16:49.539000Z TestFramework (INFO): Check the node requests the missing proofs after receiving an avaproofs message
2022-10-17T15:16:50.026000Z TestFramework (INFO): The node ignores unsollicited avaproofs
2022-10-17T15:16:53.152000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def avapeer_connected():
        node_list = []
        try:
            node_list = node.getavalanchepeerinfo(proofid_hex)[0]['node_list']
        except BaseException:
            pass

        return n.nodeid in node_list
'''
2022-10-17T15:16:54.276000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 677, in run_test
    self.test_request_missing_proofs()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 301, in test_request_missing_proofs
    spam_peer = get_ava_p2p_interface(node)
  File "/work/test/functional/test_framework/avatools.py", line 375, in get_ava_p2p_interface
    wait_until_helper(avapeer_connected, timeout=3)
  File "/work/test/functional/test_framework/util.py", line 285, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
    def avapeer_connected():
        node_list = []
        try:
            node_list = node.getavalanchepeerinfo(proofid_hex)[0]['node_list']
        except BaseException:
            pass

        return n.nodeid in node_list
''' not true after 3.0 seconds
2022-10-17T15:16:54.332000Z TestFramework (INFO): Stopping nodes
2022-10-17T15:16:59.744000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20221017_151556/abc_p2p_compactproofs_10
2022-10-17T15:16:59.744000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20221017_151556/abc_p2p_compactproofs_10/test_framework.log
2022-10-17T15:16:59.744000Z TestFramework (ERROR): 
2022-10-17T15:16:59.744000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20221017_151556/abc_p2p_compactproofs_10' to consolidate all logs
2022-10-17T15:16:59.744000Z TestFramework (ERROR): 
2022-10-17T15:16:59.744000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2022-10-17T15:16:59.744000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2022-10-17T15:16:59.744000Z TestFramework (ERROR):

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

Fabien added inline comments.
src/validation.h
871

How come this is not const ?

This revision is now accepted and ready to land.Oct 18 2022, 09:07