Page MenuHomePhabricator

add RPC (-regtest only) for testing package policy
ClosedPublic

Authored by Fabien on Jun 28 2024, 21:34.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABCfa08ca142600: add RPC (-regtest only) for testing package policy
Summary
It would be nice for LN/wallet/app devs to test out package policy, package RBF, etc., but the only interface to do so right now is through unit tests. This PR adds a -regtest only RPC interface so people can test by submitting raw transaction data. It is regtest-only, as it would be unsafe/confusing to create an actual mainnet interface while package relay doesn't exist.

Note that the functional tests are there to ensure the RPC interface is working properly; they aren't for testing policy itself. See src/test/txpackage_tests.cpp.

Backport of core#24836.

Depends on D16389.

Note 1: Because the RPCs return size (aka serialization size) or vsize (aka max(size, sigchecks bytes)), the test is technically incorrect but works because the sigchecks are never bumping the value in the test.
The RPCs need to be updated to return both values and/or the relay policy need to be updated to use vsize.

Note 2: The functional test changes the coinbases being spend and we need to change the amount due to halving.

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

Event Timeline

Fabien requested review of this revision.Jun 28 2024, 21:34

Tail of the build log:

[383/567] Linking C executable src/secp256k1/recover-bench
[384/567] Linking C executable src/secp256k1/ecmult-bench
[385/567] Linking C executable src/secp256k1/verify-bench
[386/567] Linking C executable src/secp256k1/sign-bench
[387/567] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[388/567] Linking C executable src/secp256k1/internal-bench
[389/567] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[390/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[391/567] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[392/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[393/567] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[394/567] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[395/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[396/567] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[397/567] Linking CXX executable src/bitcoin-cli
[398/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[399/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[400/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[401/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[402/567] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[403/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[404/567] Linking CXX executable src/bitcoin-tx
[405/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[406/567] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[407/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[408/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[409/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[410/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[411/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[412/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[413/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[414/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[415/567] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[416/567] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[417/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[418/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[419/567] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[420/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[421/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[422/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[423/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[424/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[425/567] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[426/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[427/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[428/567] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[429/567] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[430/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[431/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[432/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[433/567] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[434/567] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[435/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[436/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[437/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[438/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[439/567] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[440/567] 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

Remove replaced transactions that got mistakenly merged

PiRK requested changes to this revision.Jun 29 2024, 16:50
PiRK added a subscriber: PiRK.

mostly LGTM, just one debugging print to be removed

test/functional/rpc_packages.py
373

debugging leftover

This revision now requires changes to proceed.Jun 29 2024, 16:50
This revision is now accepted and ready to land.Jun 29 2024, 20:58