Page MenuHomePhabricator

Remove LOCKTIME_MEDIAN_TIME_PAST constant
ClosedPublic

Authored by PiRK on Dec 22 2023, 14:45.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCebf7d87cfd36: Remove LOCKTIME_MEDIAN_TIME_PAST constant
Summary

miner: Remove uncompiled MTP code

This removes uncompiled code in miner.cpp.

Can be checked by inserting static_assert(STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST) and compiling or by reading the source code.

Even if the code was compiled, it would be unsafe to execute, since it is not allowed to include transactions that are locked until some time after the current MTP.

Also, rename the member to cause explicit merge conflicts in case there is a patch out there referencing the variable.

Remove LOCKTIME_MEDIAN_TIME_PAST constant

The constant is exposed in policy code, which doesn't make sense:

  • Wallet and mempool need to assume the flag to be always active to function properly.
  • Setting (or unsetting) the flag has no effect on policy code.

The constant is only used in ContextualCheckBlock (consensus code) to set a flag and then read the flag again. I think this can be better achieved by using a bool. If there is a need to use a flag in the future, it will be trivial to do so then.

This is a backport of core#23637 and core#24565

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.Dec 22 2023, 14:45

Tail of the build log:

-- Installing: /results/artifacts/include/secp256k1.h
-- Installing: /results/artifacts/include/secp256k1_preallocated.h
-- Installing: /results/artifacts/include/secp256k1_recovery.h
-- Installing: /results/artifacts/include/secp256k1_schnorr.h
[365/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[366/543] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[367/543] Linking C executable src/secp256k1/ecmult-bench
[368/543] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[369/543] Linking CXX executable src/bitcoin-cli
[370/543] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[371/543] Linking C executable src/secp256k1/internal-bench
[372/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[373/543] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[374/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[375/543] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[376/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[377/543] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[378/543] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[379/543] Linking CXX executable src/bitcoin-tx
[380/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[381/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[382/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[383/543] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[384/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[385/543] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[386/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[387/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[388/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[389/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[390/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[391/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[392/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[393/543] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[394/543] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[395/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[396/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[397/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[398/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[399/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[400/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[401/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[402/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[403/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[404/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[405/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[406/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[407/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[408/543] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[409/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[410/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[411/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[412/543] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[413/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[414/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[415/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[416/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[417/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[418/543] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
PiRK planned changes to this revision.Dec 22 2023, 16:55

nMedianTimePast is now unused and causes a clang tidy warning.

remove unused BlockAssembler::nMedianTimePast
This was added in D1611 as a member variable when in the Core codebase it was just a local variable.

This revision is now accepted and ready to land.Jan 3 2024, 08:46