Page MenuHomePhabricator

txorphanage: Extract AddChildrenToWorkSet
ClosedPublic

Authored by PiRK on May 18 2022, 08:01.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABCd621e806ab30: txorphanage: Extract AddChildrenToWorkSet
Summary

Extract some common code into AddChildrenToWorkSet function.

(It's a hard knock life)

This is a backport of core#21148 [4/14]
https://github.com/bitcoin/bitcoin/pull/21148/commits/ee135c8d5b39b0cb8b301a83e286285ab926dca7

Depends on D11483

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.May 18 2022, 08:01

Failed tests logs:

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

------- Stdout: -------
2022-05-18T08:09:46.966000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220518_080908/rpc_psbt_7
2022-05-18T08:10:19.521000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/authproxy.py", line 187, in _get_response
    http_response = self.__conn.getresponse()
  File "/usr/lib/python3.7/http/client.py", line 1352, in getresponse
    response.begin()
  File "/usr/lib/python3.7/http/client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.7/http/client.py", line 271, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 135, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 271, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 372, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 399, in setup_nodes
    self.import_deterministic_coinbase_privkeys()
  File "/work/test/functional/test_framework/test_framework.py", line 428, in import_deterministic_coinbase_privkeys
    label='coinbase')
  File "/work/test/functional/test_framework/test_node.py", line 897, in importprivkey
    return self.__getattr__('importprivkey')(privkey, label, rescan)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 161, in __call__
    'POST', self.__url.path, postdata.encode('utf-8'))
  File "/work/test/functional/test_framework/authproxy.py", line 117, in _request
    return self._get_response()
  File "/work/test/functional/test_framework/authproxy.py", line 194, in _get_response
    self.__conn.timeout)})
test_framework.authproxy.JSONRPCException: 'importprivkey' RPC took longer than 30 seconds. Consider using larger timeout for calls that take longer to return. (-344)
2022-05-18T08:10:19.580000Z TestFramework (INFO): Stopping nodes
2022-05-18T08:10:19.584000Z TestFramework.node1 (ERROR): Unable to stop node.
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_node.py", line 438, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 161, in __call__
    'POST', self.__url.path, postdata.encode('utf-8'))
  File "/work/test/functional/test_framework/authproxy.py", line 116, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.7/http/client.py", line 1260, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1271, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/lib/python3.7/http/client.py", line 1112, in putrequest
    raise CannotSendRequest(self.__state)
http.client.CannotSendRequest: Request-sent
2022-05-18T08:11:24.753000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            "Node returned non-zero exit code ({}) when stopping".format(return_code))
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
'''
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/rpc_psbt.py", line 468, in <module>
    PSBTTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 156, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 286, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 524, in stop_nodes
    node.wait_until_stopped()
  File "/work/test/functional/test_framework/test_node.py", line 486, in wait_until_stopped
    timeout_factor=self.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 284, in wait_until_helper
    "Predicate {} not true after {} seconds".format(predicate_source, timeout))
AssertionError: Predicate ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            "Node returned non-zero exit code ({}) when stopping".format(return_code))
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
''' not true after 60.0 seconds
====== Bitcoin ABC functional tests: wallet_multiwallet.py ======

------- Stdout: -------
2022-05-18T08:09:10.550000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220518_080908/wallet_multiwallet_0
2022-05-18T08:09:19.741000Z TestFramework (INFO): Check for per-wallet settxfee call
2022-05-18T08:09:19.746000Z TestFramework (INFO): Test dynamic wallet loading
2022-05-18T08:09:20.268000Z TestFramework (INFO): Load first wallet
2022-05-18T08:09:20.278000Z TestFramework (INFO): Load second wallet
2022-05-18T08:09:20.285000Z TestFramework (INFO): Concurrent wallet loading
2022-05-18T08:09:20.332000Z TestFramework (INFO): Load remaining wallets
2022-05-18T08:09:20.370000Z TestFramework (INFO): Test dynamic wallet creation.
2022-05-18T08:09:20.407000Z TestFramework (INFO): Test dynamic wallet unloading
2022-05-18T08:09:22.146000Z TestFramework (INFO): Test wallet backup
2022-05-18T08:10:22.183000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            "Node returned non-zero exit code ({}) when stopping".format(return_code))
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
'''
2022-05-18T08:10:22.183000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.run_test()
  File "/work/test/functional/wallet_multiwallet.py", line 442, in run_test
    self.restart_node(0, ['-nowallet'])
  File "/work/test/functional/test_framework/test_framework.py", line 528, in restart_node
    self.stop_node(i)
  File "/work/test/functional/test_framework/test_framework.py", line 514, in stop_node
    self.nodes[i].stop_node(expected_stderr, wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 459, in stop_node
    self.wait_until_stopped()
  File "/work/test/functional/test_framework/test_node.py", line 486, in wait_until_stopped
    timeout_factor=self.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 284, in wait_until_helper
    "Predicate {} not true after {} seconds".format(predicate_source, timeout))
AssertionError: Predicate ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            "Node returned non-zero exit code ({}) when stopping".format(return_code))
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
''' not true after 60.0 seconds
2022-05-18T08:10:22.234000Z TestFramework (INFO): Stopping nodes
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/wallet_multiwallet.py", line 470, in <module>
    MultiWalletTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 156, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 286, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 520, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 438, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 161, in __call__
    'POST', self.__url.path, postdata.encode('utf-8'))
  File "/work/test/functional/test_framework/authproxy.py", line 116, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.7/http/client.py", line 1260, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 970, in send
    self.connect()
  File "/usr/lib/python3.7/http/client.py", line 942, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

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

rebase (no op) to rereun CI. The failures seem unrelated.

sdulfari requested changes to this revision.May 18 2022, 19:52
sdulfari added a subscriber: sdulfari.
sdulfari added inline comments.
src/txorphanage.cpp
120 ↗(On Diff #33582)

missing const?

This revision now requires changes to proceed.May 18 2022, 19:52

make it_by_prev a const

This revision is now accepted and ready to land.May 19 2022, 16:02
This revision was automatically updated to reflect the committed changes.