Page MenuHomePhabricator

test: avoid unneeded txid hex -> integer conversions
ClosedPublic

Authored by PiRK on Sep 29 2025, 15:42.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC8572f61a78da: test: avoid unneeded txid hex -> integer conversions
Summary

Rather than determining a CTransaction's txid as an integer by
converting it's hex value, it can be directly accessed via the
introduced .txid_int property.

This concludes backport of core#32421
https://github.com/bitcoin/bitcoin/pull/32421/commits/4ef6253017672a74c584e6e9b449ffff79f67273

Depends on D18715

Test Plan

ninja check-functional-extended

Diff Detail

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

Event Timeline

PiRK requested review of this revision.Sep 29 2025, 15:42

Failed tests logs:

====== Bitcoin ABC extended functional tests: feature_block.py ======

------- Stdout: -------
2025-09-30T05:29:12.941000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_052910_33270/feature_block_7
2025-09-30T05:29:13.754000Z TestFramework (INFO): Reject block with invalid tx: OutputMissing
2025-09-30T05:29:13.934000Z TestFramework (INFO): Reject block with invalid tx: InputMissing
2025-09-30T05:29:14.139000Z TestFramework (INFO): Reject block with invalid tx: BadInputOutpointIndex
2025-09-30T05:29:14.299000Z TestFramework (INFO): Reject block with invalid tx: DuplicateInput
2025-09-30T05:29:14.507000Z TestFramework (INFO): Reject block with invalid tx: PrevoutNullInput
2025-09-30T05:29:14.716000Z TestFramework (INFO): Reject block with invalid tx: NonexistentInput
2025-09-30T05:29:14.874000Z TestFramework (INFO): Reject block with invalid tx: SpendTooMuch
2025-09-30T05:29:14.990000Z TestFramework (INFO): Reject block with invalid tx: CreateNegative
2025-09-30T05:29:15.148000Z TestFramework (INFO): Reject block with invalid tx: CreateTooLarge
2025-09-30T05:29:15.305000Z TestFramework (INFO): Reject block with invalid tx: CreateSumTooLarge
2025-09-30T05:29:15.465000Z TestFramework (INFO): Don't reorg to a chain of the same length
2025-09-30T05:29:15.472000Z TestFramework (INFO): Reorg to a longer chain
2025-09-30T05:29:15.587000Z TestFramework (INFO): Reorg back to the original chain
2025-09-30T05:29:15.646000Z TestFramework (INFO): Reject a chain with a double spend, even if it is longer
2025-09-30T05:29:15.911000Z TestFramework (INFO): Reject a block where the miner creates too much coinbase reward
2025-09-30T05:29:16.118000Z TestFramework (INFO): Reject a chain where the miner creates too much coinbase reward, even if the chain is longer
2025-09-30T05:29:16.381000Z TestFramework (INFO): Reject a chain where the miner creates too much coinbase reward, even if the chain is longer (on a forked chain)
2025-09-30T05:29:16.652000Z TestFramework (INFO): Reject a block with a spend from a re-org'ed out tx
2025-09-30T05:29:16.855000Z TestFramework (INFO): Reject a block with a spend from a re-org'ed out tx (on a forked chain)
2025-09-30T05:29:17.165000Z TestFramework (INFO): Reject a block spending an immature coinbase.
2025-09-30T05:29:17.323000Z TestFramework (INFO): Reject a block spending an immature coinbase (on a forked chain)
2025-09-30T05:29:17.487000Z TestFramework (INFO): Accept a block of size LEGACY_MAX_BLOCK_SIZE
2025-09-30T05:29:17.547000Z TestFramework (INFO): Reject a block with coinbase input script size out of range
2025-09-30T05:29:18.186000Z TestFramework (INFO): Reject a block spending transaction from a block which failed to connect
2025-09-30T05:29:18.716000Z TestFramework (INFO): Build block 44 manually
2025-09-30T05:29:18.817000Z TestFramework (INFO): Reject a block with a non-coinbase as the first tx
2025-09-30T05:29:19.021000Z TestFramework (INFO): Reject a block with no transactions
2025-09-30T05:29:19.225000Z TestFramework (INFO): Reject a block with invalid work
2025-09-30T05:29:19.428000Z TestFramework (INFO): Reject a block with a timestamp >2 hours in the future
2025-09-30T05:29:19.480000Z TestFramework (INFO): Reject a block with invalid merkle hash
2025-09-30T05:29:19.683000Z TestFramework (INFO): Reject a block with incorrect POW limit
2025-09-30T05:29:19.887000Z TestFramework (INFO): Reject a block with two coinbase transactions
2025-09-30T05:29:20.090000Z TestFramework (INFO): Reject a block with duplicate transactions
2025-09-30T05:29:20.254000Z TestFramework (INFO): Reject a block with timestamp before MedianTimePast
2025-09-30T05:29:20.472000Z TestFramework (INFO): Reject a block with a duplicate transaction in the Merkle Tree (but with a valid Merkle Root)
2025-09-30T05:29:20.631000Z TestFramework (INFO): Reject a block with two duplicate transactions in the Merkle Tree (but with a valid Merkle Root)
2025-09-30T05:29:20.989000Z TestFramework (INFO): Reject a block with a transaction with prevout.n out of range
2025-09-30T05:29:21.147000Z TestFramework (INFO): Reject a block with a transaction with outputs > inputs
2025-09-30T05:29:21.456000Z TestFramework (INFO): Reject a block with a transaction with a duplicate hash of a previous transaction (BIP30)
2025-09-30T05:29:21.663000Z TestFramework (ERROR): Unexpected exception caught during testing
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/feature_block.py", line 756, in run_test
    self.nodes[0].gettxout(txid=duplicate_tx.hash, n=0)["confirmations"], 119
                                ^^^^^^^^^^^^^^^^^
AttributeError: 'CTransaction' object has no attribute 'hash'
2025-09-30T05:29:21.666000Z TestFramework (INFO): Stopping nodes
2025-09-30T05:29:21.718000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_052910_33270/feature_block_7
2025-09-30T05:29:21.718000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_052910_33270/feature_block_7/test_framework.log
2025-09-30T05:29:21.718000Z TestFramework (ERROR): 
2025-09-30T05:29:21.718000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_052910_33270/feature_block_7' to consolidate all logs
2025-09-30T05:29:21.718000Z TestFramework (ERROR): 
2025-09-30T05:29:21.718000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-09-30T05:29:21.718000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-09-30T05:29:21.718000Z TestFramework (ERROR):
====== Bitcoin ABC extended functional tests with the next upgrade activated: feature_block.py ======

------- Stdout: -------
2025-09-30T05:54:06.395000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_055405_33374/feature_block_7
2025-09-30T05:54:07.296000Z TestFramework (INFO): Reject block with invalid tx: OutputMissing
2025-09-30T05:54:07.503000Z TestFramework (INFO): Reject block with invalid tx: InputMissing
2025-09-30T05:54:07.707000Z TestFramework (INFO): Reject block with invalid tx: BadInputOutpointIndex
2025-09-30T05:54:07.912000Z TestFramework (INFO): Reject block with invalid tx: DuplicateInput
2025-09-30T05:54:08.119000Z TestFramework (INFO): Reject block with invalid tx: PrevoutNullInput
2025-09-30T05:54:08.325000Z TestFramework (INFO): Reject block with invalid tx: NonexistentInput
2025-09-30T05:54:08.531000Z TestFramework (INFO): Reject block with invalid tx: SpendTooMuch
2025-09-30T05:54:08.737000Z TestFramework (INFO): Reject block with invalid tx: CreateNegative
2025-09-30T05:54:08.943000Z TestFramework (INFO): Reject block with invalid tx: CreateTooLarge
2025-09-30T05:54:09.151000Z TestFramework (INFO): Reject block with invalid tx: CreateSumTooLarge
2025-09-30T05:54:09.357000Z TestFramework (INFO): Don't reorg to a chain of the same length
2025-09-30T05:54:09.466000Z TestFramework (INFO): Reorg to a longer chain
2025-09-30T05:54:09.675000Z TestFramework (INFO): Reorg back to the original chain
2025-09-30T05:54:09.780000Z TestFramework (INFO): Reject a chain with a double spend, even if it is longer
2025-09-30T05:54:10.090000Z TestFramework (INFO): Reject a block where the miner creates too much coinbase reward
2025-09-30T05:54:10.297000Z TestFramework (INFO): Reject a chain where the miner creates too much coinbase reward, even if the chain is longer
2025-09-30T05:54:10.608000Z TestFramework (INFO): Reject a chain where the miner creates too much coinbase reward, even if the chain is longer (on a forked chain)
2025-09-30T05:54:10.922000Z TestFramework (INFO): Reject a block with a spend from a re-org'ed out tx
2025-09-30T05:54:11.125000Z TestFramework (INFO): Reject a block with a spend from a re-org'ed out tx (on a forked chain)
2025-09-30T05:54:11.432000Z TestFramework (INFO): Reject a block spending an immature coinbase.
2025-09-30T05:54:11.639000Z TestFramework (INFO): Reject a block spending an immature coinbase (on a forked chain)
2025-09-30T05:54:11.952000Z TestFramework (INFO): Accept a block of size LEGACY_MAX_BLOCK_SIZE
2025-09-30T05:54:12.066000Z TestFramework (INFO): Reject a block with coinbase input script size out of range
2025-09-30T05:54:12.843000Z TestFramework (INFO): Reject a block spending transaction from a block which failed to connect
2025-09-30T05:54:13.479000Z TestFramework (INFO): Build block 44 manually
2025-09-30T05:54:13.580000Z TestFramework (INFO): Reject a block with a non-coinbase as the first tx
2025-09-30T05:54:13.783000Z TestFramework (INFO): Reject a block with no transactions
2025-09-30T05:54:13.986000Z TestFramework (INFO): Reject a block with invalid work
2025-09-30T05:54:14.189000Z TestFramework (INFO): Reject a block with a timestamp >2 hours in the future
2025-09-30T05:54:14.241000Z TestFramework (INFO): Reject a block with invalid merkle hash
2025-09-30T05:54:14.444000Z TestFramework (INFO): Reject a block with incorrect POW limit
2025-09-30T05:54:14.647000Z TestFramework (INFO): Reject a block with two coinbase transactions
2025-09-30T05:54:14.850000Z TestFramework (INFO): Reject a block with duplicate transactions
2025-09-30T05:54:15.170000Z TestFramework (INFO): Reject a block with timestamp before MedianTimePast
2025-09-30T05:54:15.491000Z TestFramework (INFO): Reject a block with a duplicate transaction in the Merkle Tree (but with a valid Merkle Root)
2025-09-30T05:54:15.699000Z TestFramework (INFO): Reject a block with two duplicate transactions in the Merkle Tree (but with a valid Merkle Root)
2025-09-30T05:54:16.106000Z TestFramework (INFO): Reject a block with a transaction with prevout.n out of range
2025-09-30T05:54:16.313000Z TestFramework (INFO): Reject a block with a transaction with outputs > inputs
2025-09-30T05:54:16.642000Z TestFramework (INFO): Reject a block with a transaction with a duplicate hash of a previous transaction (BIP30)
2025-09-30T05:54:16.849000Z TestFramework (ERROR): Unexpected exception caught during testing
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/feature_block.py", line 756, in run_test
    self.nodes[0].gettxout(txid=duplicate_tx.hash, n=0)["confirmations"], 119
                                ^^^^^^^^^^^^^^^^^
AttributeError: 'CTransaction' object has no attribute 'hash'
2025-09-30T05:54:16.902000Z TestFramework (INFO): Stopping nodes
2025-09-30T05:54:17.003000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_055405_33374/feature_block_7
2025-09-30T05:54:17.003000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_055405_33374/feature_block_7/test_framework.log
2025-09-30T05:54:17.003000Z TestFramework (ERROR): 
2025-09-30T05:54:17.003000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-master/test/tmp/test_runner_₿₵_🏃_20250930_055405_33374/feature_block_7' to consolidate all logs
2025-09-30T05:54:17.003000Z TestFramework (ERROR): 
2025-09-30T05:54:17.003000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-09-30T05:54:17.003000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-09-30T05:54:17.003000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC extended functional tests: feature_block.py
Bitcoin ABC extended functional tests with the next upgrade activated: feature_block.py

This revision is now accepted and ready to land.Sep 30 2025, 07:27