aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
AgeCommit message (Collapse)Author
2022-02-14Merge bitcoin/bitcoin#24187: Followups for getdeploymentinfoMarcoFalke
e5f0356e3ffea10f447998b7549a67e016446e81 rpc/blockchain: rename getdeploymentinfo tip/active_chain_tip to blockindex (Anthony Towns) fbab43f169924c681ef085639b3e4de6c74a4958 rpc/blockchain: a constant craving (Anthony Towns) 5179656ef83a563133e32893f4acfd61d1aebdcb trivial: comment tweaks (Anthony Towns) 32f04e6da9845c218f9bbd8b8329f35ed3678a49 rpc documentation improvements (Anthony Towns) 555eafa7930a84d8ca594bea9fe39f63cfa75076 doc: getdeploymentinfo release notes tweaks (Anthony Towns) Pull request description: Documentation, comments and trivial code changes to followup #23508. ACKs for top commit: Sjors: utACK e5f0356e3ffea10f447998b7549a67e016446e81 Tree-SHA512: 4e854a8453588901edb887504f7bfa100cc32df2e99654a5e5970032a0bd63259ba0582479e15bc09ef4792c6672715007f89eb1a7b2d7e229433a678cde9f44
2022-02-04rpc/blockchain: rename getdeploymentinfo tip/active_chain_tip to blockindexAnthony Towns
2022-02-03refactor: replace boost::filesystem with std::filesystemKiminuo
Warning: Replacing fs::system_complete calls with fs::absolute calls in this commit may cause minor changes in behaviour because fs::absolute no longer strips trailing slashes; however these changes are believed to be safe. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-01-31Merge bitcoin/bitcoin#24136: Extract CTxIn::MAX_SEQUENCE_NONFINAL constant, ↵MarcoFalke
rework BIP 65/68/112 docs fa4339e4c1bb60e0d9263d4f0fe65d03aad52f88 Extract CTxIn::MAX_SEQUENCE_NONFINAL constant (MarcoFalke) Pull request description: Extracting the constant makes it possible to attach documentation to it. Also, rework the docs for the other "sequence constants". ACKs for top commit: w0xlt: reACK fa4339e for specifying the transaction version. darosior: re-ACK fa4339e4c1bb60e0d9263d4f0fe65d03aad52f88 luke-jr: crACK fa4339e4c1bb60e0d9263d4f0fe65d03aad52f88 Tree-SHA512: 8d8f3dd5afb33eb5b72aa558e1e03de874c5ed02aa1084888e92ed86f3aaa5c725db45ded02e14cdfa67a92ac6774e97185b697f20a8ab63abbfcaa2fcd1fc6a
2022-01-30doc: Fix typos pointed out by lint-spellingbrunoerg
2022-01-28rpc/blockchain: a constant cravingAnthony Towns
2022-01-28trivial: comment tweaksAnthony Towns
2022-01-28rpc documentation improvementsAnthony Towns
2022-01-28Merge bitcoin/bitcoin#23508: Add getdeploymentinfo RPCMarcoFalke
a3809228917b8f750090c8bfec8e283391dbb524 Release notes for getdeploymentinfo rpc (Anthony Towns) 240cad09baefcf363cce36a4b2795122adfce27f rpc: getdeploymentinfo: include signalling info (Anthony Towns) 376c0c6dae2bebbb3e1352377e71fb1996d09f64 rpc: getdeploymentinfo: include block hash/height (Anthony Towns) a7469bcd35692d56f57e91b3f21d30855bdf6531 rpc: getdeploymentinfo: change stats to always refer to current period (Anthony Towns) 7f15c1841b98de6931a7ac68e16635a05d3e96cf rpc: getdeploymentinfo: allow specifying a blockhash other than tip (Anthony Towns) fd826130a0a4e67fdc26f8064f4ecb4ff79b3333 rpc: move softfork info from getblockchaininfo to getdeploymentinfo (Anthony Towns) Pull request description: The aim of this PR is to improve the ability to monitor soft fork status. It first moves the softfork section from getblockchaininfo into a new RPC named getdeploymentinfo, which is then also able to query the status of forks at an arbitrary block rather than only at the tip. In addition, bip9 status is changed to indicate the status of the given block, rather than just for the next block, and an additional field is included to indicate whether each block in the signalling period signaled. ACKs for top commit: laanwj: Code review and lightly tested ACK a3809228917b8f750090c8bfec8e283391dbb524 Sjors: tACK a3809228917b8f750090c8bfec8e283391dbb524 fjahr: tACK a3809228917b8f750090c8bfec8e283391dbb524 Tree-SHA512: 7417d733b47629f229c5128586569909250481a3e94356c52fe67a03fd42cd81745246e384b98c4115fb61587714c879e4bc3e5f5c74407d9f8f6773472a33cb
2022-01-27Merge bitcoin/bitcoin#22932: Add CBlockIndex lock annotations, guard ↵laanwj
nStatus/nFile/nDataPos/nUndoPos by cs_main 6ea56827842b9b2bd730edc38f3a7b1f46f6247b Guard CBlockIndex::nStatus/nFile/nDataPos/nUndoPos by cs_main (Jon Atack) 5d59ae0ba88849b1eb0d7350871bc19fcd5ef601 Remove/inline ReadRawBlockFromDisk(block_data, pindex, message_start) (Hennadii Stepanov) eaeeb88768db529b5241ccd42f1e87579908b4df Require IsBlockPruned() to hold mutex cs_main (Jon Atack) ca47b005770f71aa229ecc1f7b8146a96ff02151 Require CBlockIndex::IsValid() to hold cs_main (Vasil Dimov) e9f3aa5f6a7b39e8d5f2069617e5e382798d8d60 Require CBlockIndex::RaiseValidity() to hold cs_main (Vasil Dimov) 8ef457cb83fac796f8b6a56977b1016193fc1185 Require CBlockIndex::IsAssumedValid() to hold cs_main (Vasil Dimov) 572393448b4d32f91b92edc84b4200ab52d62422 Require CBlockIndex::GetUndoPos() to hold mutex cs_main (Jon Atack) 2e557ced2830fc54476e598d52225f1679205e7d Require WriteUndoDataForBlock() to hold mutex cs_main (Jon Atack) 6fd4341c10b319399c58d71c4ddeae4417e337d7 Require CBlockIndex::GetBlockPos() to hold mutex cs_main (Jon Atack) Pull request description: Issues: - `CBlockIndex` member functions `GetBlockPos()`, `GetUndoPos()`, `IsAssumedValid()`, `RaiseValidity()`, and `IsValid()` and block storage functions `WriteUndoDataForBlock()` and `IsBlockPruned()` are missing thread safety lock annotations to help ensure that they are called with mutex cs_main to avoid bugs like #22895. Doing this also enables the next step: - `CBlockIndex::nStatus` may be racy, i.e. potentially accessed by multiple threads, see #17161. A solution is to guard it by cs_main, along with fellow data members `nFile`, `nDataPos` and `nUndoPos`. This pull: - adds thread safety lock annotations for the functions listed above - guards `CBlockIndex::nStatus`, `nFile`, `nDataPos` and `nUndoPos` by cs_main How to review and test: - debug build with clang and verify there are no `-Wthread-safety-analysis` warnings - review the code to verify each annotation or lock is necessary and sensible, or if any are missing - look for whether taking a lock can be replaced by a lock annotation instead - for more information about Clang thread safety analysis, see - https://clang.llvm.org/docs/ThreadSafetyAnalysis.html - https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#lockingmutex-usage-notes - https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#threads-and-synchronization Mitigates/potentially closes #17161. ACKs for top commit: laanwj: Code review ACK 6ea56827842b9b2bd730edc38f3a7b1f46f6247b Tree-SHA512: 3ebf429c8623c51f944a7245a2e48d2aa088dec4c4914b40aa6049e89856c1ee8586f6e2e3b65195190566637a33004468b51a781e61a082248748015167569b
2022-01-26Merge bitcoin/bitcoin#16795: rpc: have raw transaction decoding infer output ↵Andrew Chow
descriptors 6498ba151b35ce9621ad00730f1fdfca55538ace transaction decoding infer output descriptors (Gregory Sanders) Pull request description: Following discussion in #16725 this is complementary data to expose. All outputs are inferred. ACKs for top commit: achow101: ACK 6498ba151b35ce9621ad00730f1fdfca55538ace meshcollider: utACK 6498ba151b35ce9621ad00730f1fdfca55538ace Tree-SHA512: 36664117ddbe46d5fdde7ed6541ef2c9d8dfb7a3636b97f363bf1c325096fe00d9d2acea2d1917ea19fdb82f1ea296c12e440c5c703d6a9bfc1a02fba028bcd8
2022-01-26Extract CTxIn::MAX_SEQUENCE_NONFINAL constantMarcoFalke
2022-01-26transaction decoding infer output descriptorsGregory Sanders
2022-01-25Guard CBlockIndex::nStatus/nFile/nDataPos/nUndoPos by cs_mainJon Atack
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-01-25Require IsBlockPruned() to hold mutex cs_mainJon Atack
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-01-25doc: Fix rpc docsMarcoFalke
Broken in commit 39d9bbe4acd7441aa9a61c57b76d887c4225a0e2
2022-01-25Merge bitcoin/bitcoin#23706: rpc: getblockfrompeer followupsMarcoFalke
923312fbf6a89efde1739da0b7209694d4f892ba rpc: use peer_id, block_hash for FetchBlock (Sjors Provoost) 34d5399211eeb61e7e7961c301fb2ddea8aa3f6a rpc: more detailed errors for getblockfrompeer (Sjors Provoost) 60243cac7286e4c4bdda7094bef4cf6d1564b583 rpc: turn already downloaded into error in getblockfrompeer (Sjors Provoost) 809d66bb65aa78048e27c2a878d6f7becaecfe11 rpc: clarify getblockfrompeer behavior when called multiple times (Sjors Provoost) 0e3d7c5ee16d5a4c061ab9a57285bceb7899b512 refactor: drop redundant hash argument from FetchBlock (Sjors Provoost) 8d1a3e6498de6087501969a9d243b0697ca3fe97 rpc: allow empty JSON object result (Sjors Provoost) bfbf91d0b2004dde358253ac174982f784b43b59 test: fancier Python for getblockfrompeer (Sjors Provoost) Pull request description: Followups from #20295. ACKs for top commit: jonatack: ACK 923312fbf6a89efde1739da0b7209694d4f892ba :package: fjahr: tested ACK 923312fbf6a89efde1739da0b7209694d4f892ba Tree-SHA512: da9eca76e302e249409c9d7f0d16cca668ed981e2ab6ca2d1743dad0d830b94b1bc5ffb9028a00764b863201945c273cc8f4409a4c9ca3817830007dffa2bc20
2022-01-19scripted-diff: rename cs_mapLocalHost -> g_maplocalhost_mutexw0xlt
-BEGIN VERIFY SCRIPT- s() { sed -i 's/cs_mapLocalHost/g_maplocalhost_mutex/g' $1; } s src/net.cpp s src/net.h s src/rpc/net.cpp s src/test/net_tests.cpp -END VERIFY SCRIPT-
2022-01-15rpc: getdeploymentinfo: include signalling infoAnthony Towns
2022-01-15rpc: getdeploymentinfo: include block hash/heightAnthony Towns
2022-01-15rpc: getdeploymentinfo: change stats to always refer to current periodAnthony Towns
On a period boundary, getdeploymentinfo (and previously getblockchaininfo) would report the status and statistics for the next block rather than the current block. Change this to always report the status/statistics of the current block, but add status-next to report the status for the next block.
2022-01-15rpc: getdeploymentinfo: allow specifying a blockhash other than tipAnthony Towns
2022-01-15rpc: move softfork info from getblockchaininfo to getdeploymentinfoAnthony Towns
2022-01-06Add src/node/* code to node:: namespaceRussell Yanofsky
2022-01-07Merge bitcoin/bitcoin#23974: Make blockstorage globals private members of ↵fanquake
BlockManager fa68a6c2fc6754c160e0f98007785602201b3c47 scripted-diff: Rename touched member variables (MarcoFalke) facd3df21f344dd84e5f28862056700c1fded17c Make blockstorage globals private members of BlockManager (MarcoFalke) faa8c2d7d75f8d9782709e73e00e35851e233392 doc: Clarify nPruneAfterHeight for signet (MarcoFalke) fad381b2f8e1beb18f748fbeb820e63545b9b0fd test: Load genesis block to allow flush (MarcoFalke) fab262174b96854d2df5bee7da578990c9e9cb1e Move blockstorage-related unload to BlockManager::Unload (MarcoFalke) fa467f3913918701c765f9bc754203b4591b894f move-only: Create WriteBlockIndexDB helper (MarcoFalke) fa88cfd3f9896d5b56ea6c111a23f90a79253c18 Move functions to BlockManager (MarcoFalke) Pull request description: Globals aren't too nice because they hide dependencies, also they make testing harder. Fix that by removing some. ACKs for top commit: Sjors: ACK fa68a6c2fc6754c160e0f98007785602201b3c47 ryanofsky: Code review ACK fa68a6c2fc6754c160e0f98007785602201b3c47. Nice changes! Tree-SHA512: 6abc5929a5e43a05e238276721d46a64a44f23dca18c2caa9775437a32351d6815d88b88757254686421531d0df13861bbd3a202e13a3192798d87a96abef65d
2022-01-05Move functions to BlockManagerMarcoFalke
Needed for a later commit
2022-01-05doc: Fix typo in getmempoolinfoMarcoFalke
2022-01-05Merge bitcoin/bitcoin#23411: refactor: Avoid integer overflow in ApplyStats ↵MarcoFalke
when activating snapshot fa996c58e8a31ebe610d186cef408b6dd3b385a8 refactor: Avoid integer overflow in ApplyStats when activating snapshot (MarcoFalke) fac01888d17423d6c23a9ce15d98fc88fb34e3cc Move AdditionOverflow to util, Add CheckedAdd with unit tests (MarcoFalke) fa526d8fb6ab8f2678a30d4536aa9c45218f5269 Add dev doc to CCoinsStats::m_hash_type and make it const (MarcoFalke) faff051560552d4405896e01920a18f698155a56 style: Remove unused whitespace (MarcoFalke) Pull request description: A snapshot contains the utxo set, including the out value. To activate the snapshot, the hash needs to be calculated. As a side-effect, the total amount in the snapshot is calculated (as the sum of all out values), but never used. Instead of running into an integer overflow in an unused result, don't calculate the result in the first place. Other code paths (using the active utxo set) can not run into an integer overflow, since the active utxo set is valid. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39716 ACKs for top commit: shaavan: reACK fa996c58e8a31ebe610d186cef408b6dd3b385a8 vasild: ACK fa996c58e8a31ebe610d186cef408b6dd3b385a8 Tree-SHA512: 4f207f634841f6f634fd02ae1e5907e343fd767524fd0e8149aa99fa9a1834fe50167d14874834d45236e9c325d567925f28129bacb7d80be29cf22277a16a14
2022-01-04doc: Mark proprietary array optionalMarcoFalke
Also, remove not needed '\n's. Can be reviewed with --word-diff-regex=.
2022-01-04Merge bitcoin/bitcoin#23936: rpc: Add and use EnsureArgsman helperMarcoFalke
fa5bb37611dea5d3e6715b0c84249e39ad1d2476 rpc: Use EnsureAnyArgsman in rpc/blockchain (MarcoFalke) fa98b6f6449d33b315a73156c6de968f1757d53a rpc: Add EnsureArgsman helper (MarcoFalke) Pull request description: This refactor doesn't change anything for the rpc layer, but it helps a bit with removing gArgs (See #21005) ACKs for top commit: shaavan: Code Review ACK fa5bb37611dea5d3e6715b0c84249e39ad1d2476 Tree-SHA512: 18f9cc90830a168acb94452b541b6e97ba9a50a0f4834698a16994c3884c833dc606e36a5538a16352e5e5cc43d3ac77cb498f877f8f5bc5dd52fa84f8bf2056
2022-01-04Merge bitcoin/bitcoin#23320: rpc: Add RPC help for getblock verbosity level 3W. J. van der Laan
059f88b6a97b7a3ae1f033885e40ac01f91e6d60 Add RPC help for getblock verbosity level 3 (Kiminuo) 1bdd5f63229ebf28c24a8656f486ed8a6c8b3787 Address review comments from #22918 (Kiminuo) Pull request description: This is a follow-up PR to #22918 which addresses review comments (first commit). The second commit adds missing RPC help for verbosity level 3. ACKs for top commit: pg156: ACK https://github.com/bitcoin/bitcoin/pull/23320/commits/059f88b6a97b7a3ae1f033885e40ac01f91e6d60 laanwj: re-ACK 059f88b6a97b7a3ae1f033885e40ac01f91e6d60 Tree-SHA512: f27d53ac34b93a304ef5668701ed2b5c986a926bc8ad0df4de89695fc9e1df26acb008611451319ea897658acd9c56c6a0555d60359960c9cd28238ebefa2d50
2022-01-02doc: Fix dumptxoutset RPC help docMarcoFalke
2022-01-02rpc: Use EnsureAnyArgsman in rpc/blockchainMarcoFalke
2022-01-02rpc: Add EnsureArgsman helperMarcoFalke
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-12-24rpc: use peer_id, block_hash for FetchBlockSjors Provoost
2021-12-24rpc: more detailed errors for getblockfrompeerSjors Provoost
2021-12-24rpc: turn already downloaded into error in getblockfrompeerSjors Provoost
2021-12-24rpc: clarify getblockfrompeer behavior when called multiple timesSjors Provoost
2021-12-24refactor: drop redundant hash argument from FetchBlockSjors Provoost
2021-12-24rpc: allow empty JSON object resultSjors Provoost
2021-12-17refactor: Avoid integer overflow in ApplyStats when activating snapshotMarcoFalke
2021-12-17style: Remove unused whitespaceMarcoFalke
2021-12-16Merge bitcoin/bitcoin#23721: wallet, refactor: Move restorewallet() logic to ↵MarcoFalke
the wallet section 62fa61fa4a33ff4d108a65d656ffe2cac4330824 refactor: remove the wallet folder if the restore fails (w0xlt) abbb7eccef3fc1c36f34756458d2792f6661e29f refactor: Move restorewallet() RPC logic to the wallet section (w0xlt) 4807f73f48f4ff1084fcf7aee94e5b14592bfda8 refactor: Implement restorewallet() logic in the wallet section (w0xlt) Pull request description: Currently `restorewallet()` logic is written in the RPC layer and it can´t be reused by GUI. So it moves this to the wallet section and then, GUI can access it. This is necessary to implement the "Restore Wallet" menu item in the GUI (which is already implemented in https://github.com/bitcoin-core/gui/pull/471 ). This commit also simplifies error handling and adds a new behavior: if the restore fails, the invalid wallet folder is removed. ACKs for top commit: achow101: ACK 62fa61fa4a33ff4d108a65d656ffe2cac4330824 shaavan: crACK 62fa61fa4a33ff4d108a65d656ffe2cac4330824 Tree-SHA512: 7ccfbad5943f38616ba0c2dd443c97a4b5bc1f6612dbf5a9e7a0263100aba36671fae929a2e7688442667be394645f44484af137a4802f204a33c4689eb27c39
2021-12-15refactor: Move restorewallet() RPC logic to the wallet sectionw0xlt
It also simplifies restorewallet() and loadwallet() RPC error handling.
2021-12-15Merge bitcoin/bitcoin#22674: validation: mempool validation and submission ↵W. J. van der Laan
for packages of 1 child + parents 046e8ff264be6b888c0f9a9d822e32aa74e19b78 [unit test] package submission (glozow) e12fafda2dfbbdf63f125e5af797ecfaa6488f66 [validation] de-duplicate package transactions already in mempool (glozow) 8310d942e046c5a9b6bd90afdcd3af68dd91e081 [packages] add sanity checks for package vs mempool limits (glozow) be3ff151a1f9665720cdf70d072b098a2f9726a9 [validation] full package accept + mempool submission (glozow) 144a29099a865ac1dc3e5291d9529fbcca9c83a4 [policy] require submitted packages to be child-with-unconfirmed-parents (glozow) d59ddc5c3d1c035474d7bc9fa9f8a0eeb1c8498c [packages/doc] define and document package rules (glozow) ba26169f6035c238378a3c9647213328a006fa23 [unit test] context-free package checks (glozow) 9b2fdca7f03911ac40fe0f8a0b5da534bee4554b [packages] add static IsChildWithParents function (glozow) Pull request description: This is 1 chunk of [Package Mempool Accept](https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a); it restricts packages to 1 child with its parents, doesn't allow conflicts, and doesn't have CPFP (yet). Future PRs (see #22290) will add RBF and CPFP within packages. ACKs for top commit: laanwj: Code review ACK 046e8ff264be6b888c0f9a9d822e32aa74e19b78 Tree-SHA512: 37dbba37d527712f8efef71ee05c90a8308992615af35f5e0cfeafc60d859cc792737d125aac526e37742fe7683ac8c155ac24af562426213904333c01260c95
2021-12-15Merge bitcoin/bitcoin#23758: net: Use type-safe mockable time for peer ↵MarcoFalke
connection time fad943821e35d0eb2143061e718f0193e12a4c71 scripted-diff: Rename touched member variables (MarcoFalke) fa663a4c0d20487ed3f7a93e1c2ca9932b05f5a8 Use mockable time for peer connection time (MarcoFalke) fad7ead146a152f46b25ce6623e05cbb1dbc8cca refactor: Use type-safe std::chrono in net (MarcoFalke) Pull request description: Benefits: * Type-safe * Mockable * Allows to revert a temporary test workaround ACKs for top commit: naumenkogs: ACK fad943821e35d0eb2143061e718f0193e12a4c71 shaavan: ACK fad943821e35d0eb2143061e718f0193e12a4c71 Tree-SHA512: af9bdfc695ab727b100c6810a7289d29b02b0ea9fa4fee9cc1f3eeefb52c8c465ea2734bae0c1c63b3b0d6264ba2c493268bc970ef6916570eb166de77829d82
2021-12-14Merge bitcoin/bitcoin#22777: net processing: don't request tx relay on ↵MarcoFalke
feeler connections eaf6be0114a6d7763767da9496907fe8a670ff9e [net processing] Do not request transaction relay from feeler connections (John Newbery) 0220b834b175dc8c45a2c60213474a72c0ef8193 [test] Add testing for outbound feeler connections (John Newbery) Pull request description: Feelers are short-lived connections used to test the viability of peers. The bitcoind node will periodically open feeler connections to addresses in its addrman, wait for a `version` message from the peer, and then close the connection. Currently, we set `fRelay` to `1` in the `version` message for feeler connections, indicating that we want the peer to relay transactions to us. However, we close the connection immediately on receipt of the `version` message, and so never process any incoming transaction announcements. This PR changes that behaviour to instead set `fRelay` to `0` indicating that we do not wish to receive transaction announcements from the peer. This PR also extends the `addconnection` RPC to allow creating outbound feeler connections from the node to the test framework, and a test to verify that the node sets `fRelay` to `0` in the `version` message to feeler connections. ACKs for top commit: naumenkogs: ACK eaf6be0114a6d7763767da9496907fe8a670ff9e MarcoFalke: review ACK eaf6be0114a6d7763767da9496907fe8a670ff9e 🏃 Tree-SHA512: 1c56837dbd0a396fe404a5e39f7459864d15f666664d6b35ad109628b13158e077e417e586bf48946a23bd5cbe63716cb4bf22cdf8781b74dfce6047b87b465a
2021-12-14refactor: remove unneeded calls to strprintf()fanquake
2021-12-13rpc: Quote user supplied strings in error messagesMarcoFalke