aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2024-10-21Merge bitcoin/bitcoin#31097: validation: Improve input script check error ↵merge-script
reporting 86e2a6b749c7fecbd086b361806ac9f6e9426d79 [test] A non-standard transaction which is also consensus-invalid should return the consensus error (Antoine Poinsot) f859ff8a4e9c3aa23bf5be6eceb7099ca72b2290 [validation] Improve script check error reporting (dergoegge) Pull request description: An input script might be invalid for multiple reasons. For example, it might fail both a standardness check and a consensus check, which can lead to a `mandatory-script-verify-flag-failed` error being reported that includes the script error string from the standardness failure (e.g. `mandatory-script-verify-flag-failed (Using OP_CODESEPARATOR in non-witness script)`), which is confusing. ACKs for top commit: darosior: re-ACK 86e2a6b749c7fecbd086b361806ac9f6e9426d79 ariard: Re-Code Review ACK 86e2a6b7 instagibbs: ACK 86e2a6b749c7fecbd086b361806ac9f6e9426d79 Tree-SHA512: 053939107c0bcd6643e9006b2518ddc3a6de47d2c6c66af71a04e8af5cf9ec207f19e54583b7a056efd77571edf5fd4f36c31ebe80d1f0777219c756c055eb42
2024-10-21Merge bitcoin/bitcoin#31063: lint: commit-script-check.sh: echo to stderrmerge-script
fac6cfe5ac06547c90da6f976d7c8bed20da8bac lint: commit-script-check.sh: echo to stderr (MarcoFalke) Pull request description: This makes it easier to redirect the produced `git diff` on failure. On success, it shouldn't hurt, because the same output is still present, just on stderr. Can be tested by introducing a fault in any scripted diff and then calling `commit-script-check.sh HEAD~..HEAD > any_file.txt`. Previously the file contained the full output, now it contains just the diff. ACKs for top commit: TheCharlatan: ACK fac6cfe5ac06547c90da6f976d7c8bed20da8bac Tree-SHA512: b4dfad10a4a902729a7ad7533ed0ef86b9e79761083f2ec623d448a551462b268fe04bdba387ca62160dae9ef7b1781e005dec60f18b111d9bfa6b97357108e6
2024-10-17Merge bitcoin/bitcoin#29877: tracing: explicitly cast block_connected ↵merge-script
duration to nanoseconds cd0edf26c07c8c615f3ae3ac040c4774dcc8e650 tracing: cast block_connected duration to nanoseconds (0xb10c) Pull request description: When the `validation:block_connected` tracepoint was introduced in 8f37f5c2a562c38c83fc40234ade9c301fc4e685, the connect block duration was passed in microseconds `µs`. By starting to use steady clock in fabf1cdb206e368a9433abf99a5ea2762a5ed2c0 this changed to nanoseconds `ns`. As the test only checked if the duration value is `> 0` as a plausibility check, this went unnoticed. This was detected this when setting up monitoring for block validation time as part of the Great Consensus Cleanup Revival discussion. This change casts the duration explicitly to nanoseconds, updates the documentation, and adds a check for an upper bound to the tracepoint interface tests. The upper bound is quite lax as mining the block takes much longer than connecting the empty test block. It's however able to detect a duration passed in an incorrect unit (1000x off). A previous version of this PR casted the duration to microseconds `µs` - however, as the last three major releases have had the duration as nanoseconds (and this went unnoticed), we assume that this is the API now and changeing it back to microseconds would break the API again. See also https://github.com/bitcoin/bitcoin/pull/29877#issuecomment-2067867597 ACKs for top commit: maflcko: re-lgtm ACK cd0edf26c07c8c615f3ae3ac040c4774dcc8e650 laanwj: re-ACK cd0edf26c07c8c615f3ae3ac040c4774dcc8e650 Tree-SHA512: 54a1eea0297e01c07c2d071ffafbf97dbd080f763e1dc0014ff086a913b739637c1634b1cf87c90b94a3c2f66006acfaada0414a15769cac761e03bc4aab2a77
2024-10-17[test] A non-standard transaction which is also consensus-invalid should ↵Antoine Poinsot
return the consensus error
2024-10-16Merge bitcoin/bitcoin#31067: test: Print CompletedProcess object on errormerge-script
fa43c4f93ca5b40734ec9b3ff91b74acf3ed7cf2 test: Print CompletedProcess object on error (MarcoFalke) Pull request description: It would be good to know the output on `Error parsing command output`. Otherwise test failures are meaningless: https://github.com/bitcoin/bitcoin/issues/30792#issuecomment-2325911157 Fix it by just printing the full `CompletedProcess` object. Also, use the modern `subprocess.run` to simplify the code. ACKs for top commit: BrandonOdiwuor: Code Review ACK fa43c4f93ca5b40734ec9b3ff91b74acf3ed7cf2 laanwj: This contains some useful information, so ACK fa43c4f93ca5b40734ec9b3ff91b74acf3ed7cf2 Tree-SHA512: ae7c1cb1f48af2a6feae6d1a5a967c0720f6c6675c1ce20ace7cac18c00f3d4069b8abcc58204855e92ff5303158b9a942bab3b71acae0737768d941a5773c91
2024-10-15Merge bitcoin/bitcoin#30859: doc: cmake: prepend "build" to ↵merge-script
functional/test_runner.py e64b2f1a16e8d0ad2cd181d84e3b70312e3cdf33 doc: cmake: prepend and explain "build/" where needed (Larry Ruane) Pull request description: This is a small follow-on to #30741, prepend `build/` to the path for `test_runner.py`. ACKs for top commit: jonatack: ACK e64b2f1a16e8d0ad2cd181d84e3b70312e3cdf33 maflcko: lgtm ACK e64b2f1a16e8d0ad2cd181d84e3b70312e3cdf33 tdb3: re ACK e64b2f1a16e8d0ad2cd181d84e3b70312e3cdf33 Tree-SHA512: 80943d4f342987bf060adacb1c7db2e9ff8de5a6da592846ba23f230281d3a5b306162c4c86e61739a29323eaa4abf09f69f41302996d5809f448e5788a74a87
2024-10-11doc: cmake: prepend and explain "build/" where neededLarry Ruane
2024-10-10test: Print CompletedProcess object on errorMarcoFalke
2024-10-10doc: lint: correct outdated comment (s/Makefile.am/CMakeLists.txt/)Sebastian Falbesoner
2024-10-10scripted-diff: drop config/ subdir for bitcoin-config.h, rename to ↵Sebastian Falbesoner
bitcoin-build-config.h Follow-up for PR #30856, commit 0dd66251. -BEGIN VERIFY SCRIPT- sed -i "s|config/bitcoin-config\.h|bitcoin-build-config.h|g" $(git grep -l config/bitcoin-config\.h) sed -i "s|bitcoin-config\.h|bitcoin-build-config.h|g" $(git grep -l "bitcoin-config\.h" ./src ./test ./cmake) git mv ./cmake/bitcoin-config.h.in ./cmake/bitcoin-build-config.h.in -END VERIFY SCRIPT-
2024-10-09lint: commit-script-check.sh: echo to stderrMarcoFalke
2024-10-08Merge bitcoin/bitcoin#30920: test: Remove 0.16.3 test from ↵merge-script
wallet_backwards_compatibility.py fae44c83da982095661b034bdd01afe8ac2fb0a6 test: Remove 0.16.3 test from wallet_backwards_compatibility.py (MarcoFalke) Pull request description: The test checks that any wallet created with current master can not be loaded with `v0.16.3`. This is interesting documentation, however it is probably not something to keep as a test, because: * It seems like an extremely unlikely (and unsupported) edge case that someone creates a wallet with master and then goes ahead to open it with a long EOL software version. * A better test would be the inverse: Create a wallet with `v0.16.3` and open it with current master. This is already tested in `wallet_upgradewallet.py`, where I've added an additional balance check before upgrading the `v0.16.3` wallet. * The test is intermittently failing when shutting down the `v0.16.3` node, for example in https://github.com/bitcoin/bitcoin/pull/30875#issuecomment-2357565564. The exact cause is unclear, but given that the test isn't worthy to keep, removing it will ensure that the error disappears. ACKs for top commit: Sjors: utACK fae44c83da982095661b034bdd01afe8ac2fb0a6 fanquake: ACK fae44c83da982095661b034bdd01afe8ac2fb0a6 - I agree that test seems to have past it's usefulness, and the fact that it otherwise causes intemittent issues is further reason to remove it. Tree-SHA512: 85bf428e616e0880198c1a7529936520505d7fa87c2eeb87a0457f13b50a163accaf5f80f9364dea978f6bd14b0b5350cda88f49aa7584682c8b5e0b0b117724
2024-10-08Merge bitcoin/bitcoin#31018: test: Treat exclude list warning as failure in CImerge-script
fa6d14eacb2a8c1c3243e3075254dfdebaa9290e test: Treat exclude list warning as failure in CI (MarcoFalke) Pull request description: An outdated exclude list or otherwise an error in the exclude list handling is usually a bug. So make it fatal in the CI, instead of silently ignoring it. Fixes https://github.com/bitcoin/bitcoin/pull/30872/files#r1757015334 Can be tested with something like (with and without `--ci`): ``` ./bld-cmake/test/functional/test_runner.py wallet_disable -x wallet_disablee ACKs for top commit: tdb3: ACK fa6d14eacb2a8c1c3243e3075254dfdebaa9290e ismaelsadeeq: utACK fa6d14eacb2a8c1c3243e3075254dfdebaa9290e Tree-SHA512: 03a70dff9d1272d982591d60ab764f9233d4802488bc1bad305a2755e2d7ed86e691ee94767a3bc5f68321b63214aba44e6f9edd1543dfad7a20f9397cf78734
2024-10-05Merge bitcoin/bitcoin#30793: rpc: add getorphantxsglozow
98c1536852d1de9a978b11046e7414e79ed40b46 test: add getorphantxs tests (tdb3) 93f48fceb7dd332ef980ce890ff7750b995d6077 test: add tx_in_orphanage() (tdb3) 34a9c10e8cdb3e9cd40fc3a420df8f73e0208a48 rpc: add getorphantxs (tdb3) f511ff3654d999951a64098c8a9f2f8e29771dad refactor: move verbosity parsing to rpc/util (tdb3) 532491faf1aa90053af52cbedce403b9eccf0bc3 net: add GetOrphanTransactions() to PeerManager (tdb3) 91b65adff2aaf16f42c5ccca6e16b951e0e84f9a refactor: add OrphanTxBase for external use (tdb3) Pull request description: This PR adds a new hidden rpc, `getorphantxs`, that provides the caller with a list of orphan transactions. This rpc may be helpful when checking orphan behavior/scenarios (e.g. in tests like `p2p_orphan_handling`) or providing additional data for statistics/visualization. ``` getorphantxs ( verbosity ) Shows transactions in the tx orphanage. EXPERIMENTAL warning: this call may be changed in future releases. Arguments: 1. verbosity (numeric, optional, default=0) 0 for an array of txids (may contain duplicates), 1 for an array of objects with tx details, and 2 for details from (1) and tx hex Result (for verbose = 0): [ (json array) "hex", (string) The transaction hash in hex ... ] Result (for verbose = 1): [ (json array) { (json object) "txid" : "hex", (string) The transaction hash in hex "wtxid" : "hex", (string) The transaction witness hash in hex "bytes" : n, (numeric) The serialized transaction size in bytes "vsize" : n, (numeric) The virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. "weight" : n, (numeric) The transaction weight as defined in BIP 141. "expiration" : xxx, (numeric) The orphan expiration time expressed in UNIX epoch time "from" : [ (json array) n, (numeric) Peer ID ... ] }, ... ] Result (for verbose = 2): [ (json array) { (json object) "txid" : "hex", (string) The transaction hash in hex "wtxid" : "hex", (string) The transaction witness hash in hex "bytes" : n, (numeric) The serialized transaction size in bytes "vsize" : n, (numeric) The virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. "weight" : n, (numeric) The transaction weight as defined in BIP 141. "expiration" : xxx, (numeric) The orphan expiration time expressed in UNIX epoch time "from" : [ (json array) n, (numeric) Peer ID ... ], "hex" : "hex" (string) The serialized, hex-encoded transaction data }, ... ] Examples: > bitcoin-cli getorphantxs 2 > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "getorphantxs", "params": [2]}' -H 'content-type: application/json' http://127.0.0.1:8332/ ``` ``` $ build/src/bitcoin-cli getorphantxs 2 [ { "txid": "50128aac5deab548228d74d846675ad4def91cd92453d81a2daa778df12a63f2", "wtxid": "bb61659336f59fcf23acb47c05dc4bbea63ab533a98c412f3a12cb813308d52c", "bytes": 133, "vsize": 104, "weight": 415, "expiration": 1725663854, "from": [ 1 ], "hex": "020000000001010b992959eaa2018bbf31a4a3f9aa30896a8144dbd5cfaf263bf07c0845a3a6620000000000000000000140fe042a010000002251202913b252fe537830f843bfdc5fa7d20ba48639a87c86ff837b92d083c55ad7c102015121c0000000000000000000000000000000000000000000000000000000000000000100000000" }, { "txid": "330bb7f701604a40ade20aa129e9a3eb8a7bf024e599084ca1026d3222b9f8a1", "wtxid": "b7651f7d4c1a40c4d01f6a1e43a121967091fa0f56bb460146c1c5c068e824f6", "bytes": 133, "vsize": 104, "weight": 415, "expiration": 1725663854, "from": [ 2 ], "hex": "020000000001013600adfe41e0ebd2454838963d270916d2b47239c9eebb93a992b720d3589a080000000000000000000140fe042a010000002251202913b252fe537830f843bfdc5fa7d20ba48639a87c86ff837b92d083c55ad7c102015121c0000000000000000000000000000000000000000000000000000000000000000100000000" } ] ``` ACKs for top commit: glozow: reACK 98c1536852d hodlinator: re-ACK 98c1536852d1de9a978b11046e7414e79ed40b46 danielabrozzoni: ACK 98c1536852d1de9a978b11046e7414e79ed40b46 pablomartin4btc: tACK 98c1536852d1de9a978b11046e7414e79ed40b46 itornaza: reACK 98c1536852d1de9a978b11046e7414e79ed40b46 Tree-SHA512: 66075f9faa83748350b87397302100d08af92cbef5fadb27f2b4903f028c08020bf34a23e17262b41abb3f379ca9f46cf6cd5459b8681f2b83bffbbaf3c03ff9
2024-10-02Merge bitcoin/bitcoin#30929: log: Enforce trailing newlineAva Chow
fa2b7d8d6b3f8d53199921e1e542072441b26fab Remove redundant unterminated-logprintf tidy check (MarcoFalke) bbbb2e43ee95c9a8866aa1f65e3f001f752dfed2 log: Enforce trailing newline, Remove redundant m_started_new_line (MarcoFalke) Pull request description: There are many problems around missing a trailing newline while logging: * All log lines are currently terminated by a trailing newline. This means any runtime code trying to handle a "missing" newline is currently dead code. * Leaving a line unterminated is racy and can cause content corruption by mixing log lines from different sources. * It requires extra code like `m_started_new_line` to keep track of, which is annoying and pointless to maintain, because it is currently dead code, see https://github.com/bitcoin/bitcoin/pull/30386#discussion_r1684380835. * It requires a standalone `unterminated-logprintf` clang-tidy plugin, which is unmaintained (no one updated it for the new log function names), probably harder to maintain than normal C++ code (because it requires clang AST matcher knowledge), brittle (it can fail to detect issues at any time, if it goes out-of-sync, or be explicitly disabled via `NOLINT`), and annoying for devs (it is slow and intricate to run locally and thus only effectively run on CI or via the CI scripts). Fix all issues by enforcing the trailing newline in logs directly in the code. Then remove all the other stuff. This refactor does not change behavior. ACKs for top commit: stickies-v: re-ACK fa2b7d8d6b3f8d53199921e1e542072441b26fab achow101: ACK fa2b7d8d6b3f8d53199921e1e542072441b26fab ryanofsky: Code review ACK fa2b7d8d6b3f8d53199921e1e542072441b26fab. Just comment and test cleanup since last review Tree-SHA512: 10ed420f6c2fdb0f491d6c880be8dd2e8beef628f510adebadf4c3849d9f5e28906519d5cbaeb295f4c7c1b07c4c88a9905b3cfe30fee3a2c91ac9fd24ae6755
2024-10-02test: add getorphantxs teststdb3
Adds functional tests for getorphantxs
2024-10-02test: add tx_in_orphanage()tdb3
Allows tests to check if a transaction is contained within the orphanage
2024-10-02test: Treat exclude list warning as failure in CIMarcoFalke
2024-10-01test: add missing sync to feature_fee_estimation.pyMartin Zumsande
Fixes a race between node 1 catching up with the chain and mining a new block in the sanity_check_rbf_estimates subtest.
2024-10-01Remove redundant unterminated-logprintf tidy checkMarcoFalke
2024-09-28test: refactor: introduce and use `TRUC_CHILD_MAX_VSIZE` constantSebastian Falbesoner
2024-09-28test: switch MiniWallet padding unit from weight to vsizeSebastian Falbesoner
The weight unit is merely a consensus rule detail and is largely irrelevant for fee-rate calculations and mempool policy rules (e.g. for package relay and TRUC limits), so there doesn't seem to be any value of using a granularity that we can't even guarantee to reach exactly anyway. Switch to the more natural unit of vsize instead, which simplifies both the padding implementation and the current tests that take use of this padding. The rather annoying multiplications by `WITNESS_SCALE_FACTOR` can then be removed and weird-looking magic numbers like `4004` can be replaced by numbers that are more connected to actual policy limit constants from the codebase, e.g. `1001` for exceeding `TRUC_CHILD_MAX_VSIZE` by one.
2024-09-27Merge bitcoin/bitcoin#30879: test: re-bucket long-running testsmerge-script
f5a2000579b140a1f51fc433706c775ca560c62c test: re-bucket long-running tests (willcl-ark) Pull request description: Re-bucket: - `p2p_node_network_limited -v*transport` - `feature_assume_utxo` On CI runners these tests are taking longer than their current bucket suggests, often being among the last to finish. Re-bucket them to improve CI efficiency. ACKs for top commit: maflcko: review ACK f5a2000579b140a1f51fc433706c775ca560c62c Tree-SHA512: 3da5c888db64a311276338270ba1dcad3eb2a24e205f6bb86fc92f767ecfa63682f13fafffff569fa0cfaea607ccb538f31e3934a086d482c3fe1be5d39f8791
2024-09-26Merge bitcoin/bitcoin#30948: test: Add missing sync_mempools() to fill_mempool()merge-script
faf801515f8fcd11a3454105cab66c38f6f240fe test: Add missing sync_mempools() to fill_mempool() (MarcoFalke) fa48be6f0233cfbd5c1eab7b832c913912062fa5 test: Refactor fill_mempool to extract send_batch helper (MarcoFalke) Pull request description: Not doing the sync will lead to (intermittent) issues, as explained in https://github.com/bitcoin/bitcoin/issues/30922#issuecomment-2364529013. Fix all issues by doing the sync by default and disable it in places that do not need the sync. Fixes #30922 ACKs for top commit: mzumsande: Tested ACK faf801515f8fcd11a3454105cab66c38f6f240fe ismaelsadeeq: Tested ACK faf801515f8fcd11a3454105cab66c38f6f240fe marcofleon: Tested ACK faf801515f8fcd11a3454105cab66c38f6f240fe Tree-SHA512: 2de62d168cbb6857a9fb8bc12c42a9093fedf5e9beb6f83a32b3fa72a5ba3cf03631055fd25ef553399a27a6fe0d71c44cfe60660a4d31986debd13b8ab00228
2024-09-24test: Add missing sync_mempools() to fill_mempool()MarcoFalke
Also disable the function, when it is not needed.
2024-09-24test: Refactor fill_mempool to extract send_batch helperMarcoFalke
This is needed for the next commit
2024-09-23Merge bitcoin/bitcoin#30678: wallet: Write best block to disk before backupAva Chow
f20fe33e94c6752e5d2ed92511c0bf51a10716ee test: Add basic balance coverage to wallet_assumeutxo.py (Fabian Jahr) 037b101e808ccf9e717751619e04f6e87d614efd test: Add coverage for best block locator write in wallet_backup (Fabian Jahr) 31c0df038909e40fe9618a4595254907ed1de907 wallet: migration, write best locator before unloading wallet (furszy) 7e3dbe4180cbeb65e59b53d9fa98509e9189549d wallet: Write best block to disk before backup (Fabian Jahr) Pull request description: I discovered that we don't write the best block to disk when trying to explain the behavior described here: https://github.com/bitcoin/bitcoin/pull/30455#discussion_r1719951882 In the context of that test, the behavior is confusing and I think it also shows that one of the already existing tests in `wallet_assumeutxo.py` doesn't actually test what it says. It only fails because the best block isn't written and actually, the height of the backup that is loaded is at the snapshot height during backup. So it really shouldn't fail since it's past the background sync blocks already. I'm not sure if this is super relevant in practice though so I am first looking for concept ACKs on the `BackupWallet` code change. Either way, I think this behavior should be documented better if it is left as is and the test should be changed. ACKs for top commit: achow101: ACK f20fe33e94c6752e5d2ed92511c0bf51a10716ee furszy: ACK f20fe33 Tree-SHA512: bb384a940df5c942fffe2eb06314ade4fc5d9b924012bfef3b1c456c4182a30825d1e137d8ae561d93d3a8a2f4d1c1ffe568132d20fa7d04844f1e289ab4a28b
2024-09-23Merge bitcoin/bitcoin#30409: Introduce waitTipChanged() mining interface, ↵Ava Chow
replace RPCNotifyBlockChange, drop CRPCSignals & g_best_block 7942951e3fcc58f7db0059546d03be9ea243f1db Remove unused g_best_block (Ryan Ofsky) e3a560ca68d79b056a105a65ed0c174a9631aba9 rpc: use waitTipChanged for longpoll (Ryan Ofsky) 460687a09c2af336fce853d9ffb790d01429eec6 Remove unused CRPCSignals (Sjors Provoost) dca923150e3ac10a57c23a7e29e76516d32ec10d Replace RPCNotifyBlockChange with waitTipChanged() (Sjors Provoost) 2a40ee1121903847cdd3f6c5b4796e4d5471b2df rpc: check for negative timeout arg in waitfor* (Sjors Provoost) de7c855b3af99fe6b62279c5c2d08888a5437c4a rpc: recommend -rpcclienttimeout=0 for waitfor* (Sjors Provoost) 77ec072925a6d558b3c6b075becbed44727c5989 rpc: fix waitfornewblock description (Sjors Provoost) 285fe9fb51c808a9edd91b05bd3134fc18de0fb6 rpc: add test for waitforblock and waitfornewblock (Sjors Provoost) b94b27cf05c709674117e308e441a8d1efddcd0a Add waitTipChanged to Mining interface (Sjors Provoost) 7eccdaf16081d6f624c4dc21df75b0474e049d2b node: Track last block that received a blockTip notification (Sjors Provoost) ebb8215f23644f901c46fd4977b7d4b08fae5104 Rename getTipHash() to getTip() and return BlockRef (Sjors Provoost) 89a8f74bbbb900abfb3d8e946eea18ad7b1513ad refactor: rename BlockKey to BlockRef (Sjors Provoost) Pull request description: This continues the work in #30200 so that a future Stratum v2 Template Provider (see #29432) can avoid accessing node internals. It needs to know when a new block arrives in order to push new templates to connected clients. `waitTipChanged()` uses a new kernel notification `notifications().m_tip_block_mutex`, which this PR also introduces (a previous version used `g_best_block`). In order to ensure the new method works as intended, the `waitfornewblock`, `waitforblock` and `waitforblockheight` RPC methods are refactored to use it. This allows removing `RPCNotifyBlockChange`. There's a commit to add (direct) tests for the methods that are about to be refactored: - `waitfornewblock` was already implicitly tested by `feature_shutdown.py`. - `waitforblockheight` by `feature_coinstatsindex.py` and `example_test.py` This PR renames `getTipHash()` to `getTip()` and returns a `BlockRef` (renamed from `BlockKey`) so that callers can use either the height or hash. The later commits make trivial improvements to the `waitfor*` RPC calls (not needed for this PR). The `waitTipChanged()` method could probably also be used for the longpoll functionality in `getblocktemplate`, but I'm a bit reluctant to touch that. `RPCServer::OnStarted` no longer does anything and `RPCServer::OnStopped` merely prints a log statement. They were added in #5711 as a refactor. This PR drops them entirely. Finally `g_best_block` is also dropped. ACKs for top commit: achow101: ACK 7942951e3fcc58f7db0059546d03be9ea243f1db ryanofsky: Code review ACK 7942951e3fcc58f7db0059546d03be9ea243f1db. Just rebased since last review TheCharlatan: Re-ACK 7942951e3fcc58f7db0059546d03be9ea243f1db Tree-SHA512: a5559446b4000c95e07aad33284b7ee2e57aafd87e1ae778b3825d59689566d047a8047e47a10f76e6e341e7dc72fd265a65afbc0a9c011d17c4cafd55031837
2024-09-23test: re-bucket long-running testswillcl-ark
- p2p_node_network_limited -v*transport - feature_assume_utxo On CI runners these tests are taking longer than their current bucket suggests, often being among the last to finish. Re-bucket them to improve CI efficiency.
2024-09-22test: Add basic balance coverage to wallet_assumeutxo.pyFabian Jahr
2024-09-20Merge bitcoin/bitcoin#30679: fix: handle invalid `-rpcbind` port earlierAva Chow
e6994efe08b282dd9e46602bcbad69567fe91dcd fix: increase rpcbind check robustness (tdb3) d38e3aed89eea665399eef07f5c3b64b14d4f586 fix: handle invalid rpcbind port earlier (tdb3) 83b67f2e6d59ea5de6573314ea4fe54ae52b7c12 refactor: move host/port checking (tdb3) 73c243965ab256ece089d14173c2d285955e83d5 test: add tests for invalid rpcbind ports (tdb3) Pull request description: Previously, when an invalid port was specified in `-rpcbind`, the `SplitHostPort()` return value in `HTTPBindAddresses()` was ignored and attempt would be made to bind to the default rpcbind port (with the host/port treated as a host). This rearranges port checking code in `AppInitMain()` to handle the invalid port before reaching `HTTPBindAddresses()`. Also adds a check in `HTTPBindAddresses()` as a defensive measure for future changes. Adds then updates associated functional tests as well. ACKs for top commit: achow101: ACK e6994efe08b282dd9e46602bcbad69567fe91dcd ryanofsky: Code review ACK e6994efe08b282dd9e46602bcbad69567fe91dcd zaidmstrr: Code review ACK [e6994ef](https://github.com/bitcoin/bitcoin/commit/e6994efe08b282dd9e46602bcbad69567fe91dcd) Tree-SHA512: bcc3e5ceef21963821cd16ce6ecb83d5c5657755882c05872a7cfe661a1492b1d631f54de22f41fdd173512d62dd15dc37e394fe1a7abe4de484b82cd2438b92
2024-09-20Merge bitcoin/bitcoin#26990: cli: Improve error message on multiwallet ↵Ava Chow
cli-side commands 54227e681a4efa8961f1ad05d43366d88a9b686a rpc, cli: improve error message on multiwallet mode (pablomartin4btc) Pull request description: Running a CLI command when multiple wallets are loaded and `-rpcwallet` is not specified, should return a clearer error. Currently in `master`: ``` $ bitcoin-cli -regtest -generate 1 error code: -19 error message: Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path). Try adding "-rpcwallet=<filename>" option to bitcoin-cli command line. ``` With this change: ``` $ bitcoin-cli -regtest -generate 1 error code: -19 error message: Multiple wallets are loaded. Please select which wallet to use by requesting the RPC through the /wallet/<walletname> URI path. Or for the CLI, specify the "-rpcwallet=<walletname>" option before the command (run "bitcoin-cli -h" for help or "bitcoin-cli listwallets" to see which wallets are currently loaded). ``` ACKs for top commit: maflcko: review ACK 54227e681a4efa8961f1ad05d43366d88a9b686a achow101: ACK 54227e681a4efa8961f1ad05d43366d88a9b686a furszy: utACK 54227e681a4 mzumsande: Code Review ACK 54227e681a4efa8961f1ad05d43366d88a9b686a jonatack: ACK 54227e681a4efa8961f1ad05d43366d88a9b686a Tree-SHA512: 51ff24f64858aa6be6adf6f20105c9f076ebea743780bf2a4399f7fe8b5239cbb1ea06d32b2ef5e850da2369abb0ef7a52c50c2b8f31f4ca90d3a486abc9b77e
2024-09-20test: Add coverage for best block locator write in wallet_backupFabian Jahr
2024-09-20wallet: Write best block to disk before backupFabian Jahr
This ensures that the best block is included in the backup which leads to a more consistent behavior when loading the backup.
2024-09-19Merge bitcoin/bitcoin#30889: log: Use ConstevalFormatStringmerge-script
facbcd4cef8890ae18976fb53b67ea56b3c04454 log: Use ConstevalFormatString (MarcoFalke) fae9b60c4ffef38d9725f42f992b1f38765312a3 test: Use LogPrintStr to test m_log_sourcelocations (MarcoFalke) fa39b1ca63874db8ef8bc16b87e2699e8e1b67be doc: move-only logging warning (MarcoFalke) Pull request description: This changes all logging (including the wallet logging) to produce a `ConstevalFormatString` at compile time, so that the format string can be validated at compile-time. I tested with `clang` and found that the compiler will use less than 1% more of time and memory. When an error is found, the compile-time error depends on the compiler, but it may look similar to: ``` src/util/string.h: In function ‘int main(int, char**)’: src/bitcoind.cpp:265:5: in ‘constexpr’ expansion of ‘util::ConstevalFormatString<1>(((const char*)"Hi %s %s"))’ src/util/string.h:38:98: in ‘constexpr’ expansion of ‘util::ConstevalFormatString<1>::Detail_CheckNumFormatSpecifiers(std::basic_string_view<char>(((const char*)((util::ConstevalFormatString<1>*)this)->util::ConstevalFormatString<1>::fmt)))’ src/util/string.h:78:34: error: expression ‘<throw-expression>’ is not a constant expression 78 | if (num_params != count) throw "Format specifier count must match the argument count!"; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` This refactor does not change behavior of the compiled executables. ACKs for top commit: hodlinator: re-ACK facbcd4cef8890ae18976fb53b67ea56b3c04454 l0rinc: ACK facbcd4cef8890ae18976fb53b67ea56b3c04454 ryanofsky: Code review ACK facbcd4cef8890ae18976fb53b67ea56b3c04454 pablomartin4btc: re-ACK facbcd4cef8890ae18976fb53b67ea56b3c04454 stickies-v: Approach ACK and code LGTM facbcd4cef8890ae18976fb53b67ea56b3c04454 modulo a `tinyformat::format_error` concern. Tree-SHA512: 852f74d360897020f0d0f6e5064edc5e7f7dacc2bec1d5feff22c634a2fcd2eb535aa75be0b7191d9053728be6108484c737154b02d68ad3186a2e5544ba0db8
2024-09-18Merge bitcoin/bitcoin#30875: doc: fixed inconsistencies in documentation ↵merge-script
between autotools to cmake change a9964c04447745435747d9cc557165c43902783b doc: Updating docs from autotools to cmake (kevkevinpal) Pull request description: A bit of a followup from https://github.com/bitcoin/bitcoin/pull/30840 - In this change the documentation where we refer to the `./configure` script which is now gone and have converted the configure params to use the `cmake` equivalent. ACKs for top commit: maflcko: ACK a9964c04447745435747d9cc557165c43902783b jonatack: utACK a9964c04447745435747d9cc557165c43902783b jarolrod: ACK a9964c04447745435747d9cc557165c43902783b tdb3: ACK a9964c04447745435747d9cc557165c43902783b pablomartin4btc: re-ACK a9964c04447745435747d9cc557165c43902783b Tree-SHA512: f7ed20b8ad61f028c0d242b9cc70650d8da63057d4a8f7da88f0117a8d3241c5fe8fcf19d56ec82088160b9fee9b175fe9f64e5a845260d3696dc7e94bfdd0bd
2024-09-18doc: Updating docs from autotools to cmakekevkevinpal
replaced --enable-debug with -DCMAKE_BUILD_TYPE=Debug in developer-notes replaced --enable-multiprocess with -DWITH_MULTIPROCESS=ON replaced --disable-zmq with -DWITH_ZMQ=OFF
2024-09-18test: Remove 0.16.3 test from wallet_backwards_compatibility.pyMarcoFalke
2024-09-17fix: handle invalid rpcbind port earliertdb3
Previously, when an invalid port was specified in `-rpcbind`, the `SplitHostPort()` return value in `HTTPBindAddresses()` was ignored and attempt would be made to bind to the default rpcbind port (with the host/port treated as a host). This rearranges port checking code in `AppInitMain()` to handle the invalid port before reaching `HTTPBindAddresses()`. Also adjusts associated functional tests.
2024-09-17test: add tests for invalid rpcbind portstdb3
2024-09-17rpc, cli: improve error message on multiwallet modepablomartin4btc
The primary objective is to provide users with clearer and more informative error messages when encountering the RPC_WALLET_NOT_SPECIFIED error, which occurs when multiple wallets are loadad. This commit also rectifies the error message consistency by bringing the error message in line with the definition established in protocol.h ("error when there are multiple wallets loaded").
2024-09-17log: Use ConstevalFormatStringMarcoFalke
This changes all logging (including the wallet logging) to produce a ConstevalFormatString at compile time, so that the format string can be validated at compile-time. Also, while touching the wallet logging, avoid a copy of the template Params by using const Params&.
2024-09-17rpc: add test for waitforblock and waitfornewblockSjors Provoost
2024-09-16Merge bitcoin/bitcoin#30410: rpc, rest: Improve block rpc error handling, ↵Ava Chow
check header before attempting to read block data. 6a1aa510e31e8b77793341473aa5afc9d023a6e3 rpc: check block index before reading block / undo data (Martin Zumsande) 6cbf2e5f8197e51b8f3d789ba9f5874a2fd7b93a rpc: Improve gettxoutproof error when only header is available. (Martin Zumsande) 69fc867ea19ba3bd8c38a18b5e3f0e366c46af5b test: add coverage to getblock and getblockstats (Martin Zumsande) 5290cbd58504dcbab97cb0944b3ae0a0f79c4502 rpc: Improve getblock / getblockstats error when only header is available. (Martin Zumsande) e5b537bbdfbfb43ac7bd8e91958e4a2bbd2577ff rest: improve error when only header of a block is available. (Martin Zumsande) Pull request description: Fixes #20978 If a block was pruned, `getblock` already returns a specific error: "Block not available (pruned data)". But if we haven't received the full block yet (e.g. in a race with block downloading after a new block was received headers-first, or during IBD) we just return an unspecific "Block not found on disk" error and log `ERROR: ReadBlockFromDisk: OpenBlockFile failed for FlatFilePos(nFile=-1, nPos=0) ` which suggest something went wrong even though this is a completely normal and expected situation. This PR improves the error message and stops calling `ReadRawBlockFromDisk()`, when we already know from the header that the block is not available on disk. Similarly, it prevents all other rpcs from calling blockstorage read functions unless we expect the data to be there, so that `LogError()` will only be thrown when there is an actual file system problem. I'm not completely sure if the cause is important enough to change the wording of the rpc error, that some scripts may rely on. If reviewers prefer it, an alternative solution would be to keep returning the current "Block not found on disk" error, but return it immediately instead of calling `ReadRawBlockFromDisk`, which would at least prevent the log error and also be an improvement in my opinion. ACKs for top commit: fjahr: re-ACK 6a1aa510e31e8b77793341473aa5afc9d023a6e3 achow101: ACK 6a1aa510e31e8b77793341473aa5afc9d023a6e3 andrewtoth: re-ACK 6a1aa510e31e8b77793341473aa5afc9d023a6e3 Tree-SHA512: 491aef880e8298a05841c4bf8eb913ef84820d1ad5415fd17d9b441bff181959ebfdd432b5eb8347dc9c568433f9a2384ca9d84cd72c79d8a58323ca117538fe
2024-09-13Merge bitcoin/bitcoin#30892: test: Check already deactivated network stays ↵Ava Chow
suspended after dumptxoutset 72c9a1fe94f927220d3159f516fda684ae9d4caa test: Check that network stays suspended after dumptxoutset if it was off before (Fabian Jahr) Pull request description: Follow-up to #30817 which covered the robustness of `dumptxoutset`: network is deactivated during the run but re-activated even when an issue was encountered. But it did not cover the case if the user had deactivated the network themselves before. In that case the user may want the network to stay off so the network is not reactivated after `dumptxoutset` finishes. A test for this behavior is added here. ACKs for top commit: achow101: ACK 72c9a1fe94f927220d3159f516fda684ae9d4caa pablomartin4btc: ACK 72c9a1fe94f927220d3159f516fda684ae9d4caa theStack: utACK 72c9a1fe94f927220d3159f516fda684ae9d4caa tdb3: tested ACK 72c9a1fe94f927220d3159f516fda684ae9d4caa Tree-SHA512: 18a57c5782e99a018414db0597e88debeb32666712c2a75dddbb55135d8f1ddd1eeacba8bbbd35fc03b6c4ab0522fe074ec08edea729560b018f51efabf00e89
2024-09-13rpc: check block index before reading block / undo dataMartin Zumsande
This avoids low-level log errors that are supposed to only occur when there is an actual problem with the block on disk missing unexpectedly, but not in the case where the block and/or undo data are expected not to be there. It changes behavior such that in the first case (block index indicates data is available but retrieving it fails) an error is thrown. It also adjusts a functional tests that tried to simulate not having undo data (but having block data) by deleting the undo file. This situation should occur reality because block and undo data are pruned together. Instead, test this situation with a block that hasn't been connected.
2024-09-13rpc: Improve gettxoutproof error when only header is available.Martin Zumsande
2024-09-13test: add coverage to getblock and getblockstatsMartin Zumsande
also removes an unnecessary newline. Co-authored-by: tdb3 <106488469+tdb3@users.noreply.github.com>
2024-09-13rpc: Improve getblock / getblockstats error when only header is available.Martin Zumsande
This improves the error message of the getblock and getblockstats rpc and prevents calls to ReadRawBlockFromDisk(), which are unnecessary if we know from the header nStatus field that the block is not available.
2024-09-12test: Check that network stays suspended after dumptxoutset if it was off beforeFabian Jahr