Page MenuHomePhabricator

[avalanche] Don't expire finalized transactions
ClosedPublic

Authored by Fabien on Jun 10 2025, 13:41.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC18b2879c6bd3: [avalanche] Don't expire finalized transactions
Summary

These txs should never turn invalid. As a consequence they should never be removed from the mempool/finalized tree after they are finalized.

Depends on D18233.

Test Plan
./test/functional/test_runner.py abc_p2p_avalanche_transaction_finalization

Diff Detail

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

Event Timeline

Fabien planned changes to this revision.Jun 10 2025, 13:45

Tail of the build log:

[404/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[405/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[406/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[407/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[408/584] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[409/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[410/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[411/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[412/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[413/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[414/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[415/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[416/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[417/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[418/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[419/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[420/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[421/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[422/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[423/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[424/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[425/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[426/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[427/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[428/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[429/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[430/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[431/584] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[432/584] Linking CXX static library src/wallet/libwallet.a
[433/584] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[434/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[435/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[436/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[437/584] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[438/584] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[439/584] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[440/584] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[441/584] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[442/584] Building CXX object src/CMakeFiles/server.dir/rpc/server_util.cpp.o
[443/584] Building CXX object src/CMakeFiles/server.dir/policy/block/stakingrewards.cpp.o
[444/584] Linking CXX executable src/iguana/iguana
[445/584] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[446/584] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
FAILED: src/CMakeFiles/server.dir/net_processing.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/leveldb/helpers/memenv -I/work/src/. -I/work/abc-ci-builds/build-clang/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/net_processing.cpp.o -MF src/CMakeFiles/server.dir/net_processing.cpp.o.d -o src/CMakeFiles/server.dir/net_processing.cpp.o -c /work/src/net_processing.cpp
/work/src/net_processing.cpp:4688:19: error: calling function 'isAvalancheFinalized' requires holding mutex 'm_mempool.cs' exclusively [-Werror,-Wthread-safety-analysis]
    if (m_mempool.isAvalancheFinalized(id)) {
                  ^
1 error generated.
[447/584] Building CXX object src/CMakeFiles/server.dir/node/miner.cpp.o
[448/584] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[449/584] Building CXX object src/CMakeFiles/server.dir/node/blockstorage.cpp.o
[450/584] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[451/584] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[452/584] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[453/584] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[454/584] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[455/584] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

[397/582] Building CXX object src/CMakeFiles/server.dir/rpc/server.cpp.o
[398/582] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[399/582] Linking CXX executable src/bitcoin-cli
[400/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[401/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[402/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[403/582] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[404/582] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[405/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[406/582] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[407/582] Linking CXX executable src/bitcoin-tx
[408/582] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[409/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[410/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[411/582] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[412/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[413/582] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[414/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[415/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[416/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[417/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[418/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[419/582] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[420/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[421/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[422/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[423/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[424/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[425/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[426/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[427/582] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[428/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[429/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[430/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[431/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[432/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[433/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[434/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[435/582] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[436/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[437/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[438/582] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[439/582] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[440/582] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[441/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[442/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[443/582] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[444/582] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[445/582] Linking CXX executable src/iguana/iguana
[446/582] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[447/582] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[448/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[449/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[450/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[451/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[452/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[453/582] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[454/582] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1

Failed tests logs:

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

------- Stdout: -------
2025-06-10T13:55:12.908000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250610_135228_55233/abc_p2p_avalanche_cooldown_56
2025-06-10T13:55:17.133000Z TestFramework (INFO): First poll is legit
2025-06-10T13:55:17.188000Z TestFramework (INFO): Subsequent polls are spams for type {CInv().typemap[inv[1]]}
2025-06-10T13:55:17.340000Z TestFramework (INFO): Subsequent polls are spams for type {CInv().typemap[inv[1]]}
2025-06-10T13:55:17.492000Z TestFramework (INFO): Subsequent polls are spams for type {CInv().typemap[inv[1]]}
2025-06-10T13:55:17.644000Z TestFramework (INFO): Subsequent polls are spams for unknown type
2025-06-10T13:55:22.109000Z TestFramework (INFO): First poll is legit for type Block
2025-06-10T13:55:22.164000Z TestFramework (INFO): Subsequent polls are legit
2025-06-10T13:55:22.733000Z TestFramework (INFO): First poll is legit for type avalanche proof
2025-06-10T13:55:22.789000Z TestFramework (INFO): Subsequent polls are legit
2025-06-10T13:55:23.355000Z TestFramework (INFO): First poll is legit for type TX
2025-06-10T13:55:23.505000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 152, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 142, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_cooldown.py", line 139, in run_test
    check_poll(inv=inv, expect_response=True)
  File "/work/test/functional/abc_p2p_avalanche_cooldown.py", line 80, in check_poll
    response = poll_node.wait_for_avaresponse()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/avatools.py", line 239, in wait_for_avaresponse
    self.wait_until(lambda: len(self.avaresponses) > 0, timeout=timeout)
  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 302, in wait_until_helper
    if predicate():
       ^^^^^^^^^^^
  File "/work/test/functional/test_framework/p2p.py", line 579, in test_function
    assert self.is_connected
AssertionError
2025-06-10T13:55:23.557000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_p2p_avalanche_cooldown.py", line 167, in <module>
    AvalancheCooldownTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 175, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 404, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 659, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 537, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 46, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 146, in __call__
    response, status = self._request(
                       ^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 114, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1076, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.11/http/client.py", line 998, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe
====== Bitcoin ABC functional tests: abc_p2p_avalanche_transaction_voting.py ======

------- Stdout: -------
2025-06-10T13:52:31.550000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250610_135228_55233/abc_p2p_avalanche_transaction_voting_4
2025-06-10T13:52:34.258000Z TestFramework (INFO): Check the votes are unknown while the quorum is not established
2025-06-10T13:52:34.266000Z TestFramework (INFO): Check the votes on valid mempool transactions
2025-06-10T13:52:36.942000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 152, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 142, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 101, in run_test
    assert_response(
  File "/work/test/functional/test_framework/avatools.py", line 526, in assert_response
    response = poll_node.wait_for_avaresponse()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/avatools.py", line 239, in wait_for_avaresponse
    self.wait_until(lambda: len(self.avaresponses) > 0, timeout=timeout)
  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 302, in wait_until_helper
    if predicate():
       ^^^^^^^^^^^
  File "/work/test/functional/test_framework/p2p.py", line 579, in test_function
    assert self.is_connected
AssertionError
2025-06-10T13:52:36.995000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_p2p_avalanche_transaction_voting.py", line 616, in <module>
    AvalancheTransactionVotingTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 175, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 404, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 659, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 537, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 46, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 146, in __call__
    response, status = self._request(
                       ^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 114, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1076, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.11/http/client.py", line 998, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

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

PiRK added inline comments.
src/txmempool.cpp
802 ↗(On Diff #54432)

Is the log line now going to be printed every time a new transaction enters the mempool as long as those finalized transactions are still in the mempool?

Fabien planned changes to this revision.Jun 10 2025, 19:57
Fabien added inline comments.
src/txmempool.cpp
802 ↗(On Diff #54432)

Hum yes. This is a very rare event but I should do the same as the size limit log and print the number of txs, not each txid

Be less verbose to avoid bloating the log

This revision is now accepted and ready to land.Jun 11 2025, 06:51