aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
AgeCommit message (Collapse)Author
2022-02-22Merge bitcoin/bitcoin#24367: User-facing content and codebase doc fixups ↵laanwj
from transifex translator feedback 48742693acc9de837735674057c9aae2fe90bd1d Replace "can not" with "cannot" in docs, user messages, and tests (Jon Atack) e670edd43441ecb6e5978d65348501c57d856030 User-facing content fixups from transifex translator feedback (Jon Atack) Pull request description: Closes #24366. ACKs for top commit: laanwj: Code review re-ACK 48742693acc9de837735674057c9aae2fe90bd1d hebasto: re-ACK 48742693acc9de837735674057c9aae2fe90bd1d, only suggested change since my previous [review](https://github.com/bitcoin/bitcoin/pull/24367#pullrequestreview-885938219). Tree-SHA512: 4dcdcb417251a413e65fab6070515e13a1267c8e0dbcf521386b842511391f24c84a0c2168fe13458c977682034466509bf2a3453719d4d94d3c568fd9f4adb4
2022-02-21Replace "can not" with "cannot" in docs, user messages, and testsJon Atack
2022-02-14Move `GetAllOutputTypes` function from `rpc/rawtransaction.cpp` to ↵Kiminuo
`rpc/util.{h|cpp}`
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-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-06Add src/node/* code to node:: namespaceRussell Yanofsky
2022-01-04doc: Mark proprietary array optionalMarcoFalke
Also, remove not needed '\n's. Can be reviewed with --word-diff-regex=.
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-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-11rpc: output all hash preimages in 'decodepsbt'Antoine Poinsot
2021-12-10Merge global xpubs in joinpsbts and combinepsbtsAndrew Chow
2021-12-10Add global_xpubs to decodepsbtAndrew Chow
2021-12-10Output proprietary type info in decodepsbtAndrew Chow
2021-12-10Output psbt version in decodepsbtAndrew Chow
2021-12-10Merge bitcoin/bitcoin#22514: psbt: Actually use SIGHASH_DEFAULT for PSBT signingMarcoFalke
c0405ee27fa23a9868f04c052bdc94d7accc57e2 rpc: Document that DEFAULT is for Taproot, ALL for everything else (Andrew Chow) d3992669df826899a3de78a77a366dab46028026 psbt: Actually use SIGHASH_DEFAULT (Andrew Chow) eb9a1a2c595a03475fd4275b104676b7e2200f07 psbt: Make sighash_type std::optional<int> (Andrew Chow) Pull request description: Make the behavior align with the help text by actually using SIGHASH_DEFAULT as the default sighash for signing PSBTs. ACKs for top commit: Sjors: re-utACK c0405ee27fa23a9868f04c052bdc94d7accc57e2 Tree-SHA512: 5199fb41de416b2f10ac451f824e7c94b428ba11fdb9e50f0027c692e959ce5813a340c34a4e52d7aa128e12008303d80939a693eff36a869720e45442119828
2021-12-08rpc: Document that DEFAULT is for Taproot, ALL for everything elseAndrew Chow
2021-12-08psbt: Make sighash_type std::optional<int>Andrew Chow
It is better to ues an optional to determine whether the sighash type is set rather than using 0 as a magic number.
2021-12-08scripted-diff: Use named args in RPC docsMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i -e 's|, /\* optional \*/ true,|, /*optional=*/true,|g' $( git grep -l ', /\* optional \*/ true,' ) -END VERIFY SCRIPT-
2021-12-08Merge bitcoin/bitcoin#20295: rpc: getblockfrompeerMarcoFalke
dce8c4c38111556ca480aa0e63c46b71f66b508f rpc: getblockfrompeer (Sjors Provoost) b884ababc29ce963826d8a4327ed6a5e629ff175 rpc: move Ensure* helpers to server_util.h (Sjors Provoost) Pull request description: This adds an RPC method to fetch a block directly from a peer. This can used to fetch stale blocks with lower proof of work that are normally ignored by the node (`headers-only` in `getchaintips`). Usage: ``` bitcoin-cli getblockfrompeer HASH peer_n ``` Closes #20155 Limitations: * you have to specify which peer to fetch the block from * the node must already have the header ACKs for top commit: jnewbery: ACK dce8c4c38111556ca480aa0e63c46b71f66b508f fjahr: re-ACK dce8c4c38111556ca480aa0e63c46b71f66b508f Tree-SHA512: 843ba2b7a308f640770d624d0aa3265fdc5c6ea48e8db32269b96a082b7420f7953d1d8d1ef2e6529392c7172dded9d15639fbc9c24e7bfa5cfb79e13a5498c8
2021-12-06rpc: Only allow specific types to be P2(W)SH wrapped in decodescriptMarcoFalke
2021-12-02Merge bitcoin/bitcoin#23642: refactor: Call type-solver earlier in decodescriptMarcoFalke
33330702081f67cb05fd86e00b252f6355249513 refactor: Call type-solver earlier in decodescript (MarcoFalke) fab0d998f4bf0f3f09afa51845d91408dd484408 style: Remove whitespace (MarcoFalke) Pull request description: The current logic is a bit confusing. First creating the `UniValue` return dict, then parsing it again to get the type as `std::string`. Clean this up by using a strong type `TxoutType`. Also, remove whitespace. ACKs for top commit: shaavan: ACK 33330702081f67cb05fd86e00b252f6355249513 theStack: Code-review ACK 33330702081f67cb05fd86e00b252f6355249513 Tree-SHA512: 49db7bc614d2491cd3ec0177d21ad1e9924dbece1eb5635290cd7fd18cb30adf4711b891daf522e7c4f6baab3033b66393bbfcd1d4726f24f90a433124f925d6
2021-12-02rpc: move Ensure* helpers to server_util.hSjors Provoost
2021-12-01doc: Extract CreateTxDoc in rawtransactionfanquake
For the fields: inputs, outputs, locktime, replaceable
2021-12-01refactor: Call type-solver earlier in decodescriptMarcoFalke
Also, remove std::string type.
2021-12-01style: Remove whitespaceMarcoFalke
Can be reviewed via --ignore-all-space
2021-11-29[validation] de-duplicate package transactions already in mempoolglozow
As node operators are free to set their mempool policies however they please, it's possible for package transaction(s) to already be in the mempool. We definitely don't want to reject the entire package in that case (as that could be a censorship vector). We should still return the successful result to the caller, so add another result type to MempoolAcceptResult.
2021-11-17doc: Fix incorrect C++ named argsMarcoFalke
2021-11-10Merge bitcoin/bitcoin#23173: Add `ChainstateManager::ProcessTransaction`MarcoFalke
0fdb619aaf1d62598263361a6082d182be1af792 [validation] Always call mempool.check() after processing a new transaction (John Newbery) 2c64270bbe523ef87e7225c351464e7c716f0b3e [refactor] Don't call AcceptToMemoryPool() from outside validation.cpp (John Newbery) 92a3aeecf6a82e9cbc9fda11022b0548efd24d05 [validation] Add CChainState::ProcessTransaction() (John Newbery) 36167faea92c97ddea7403280a5074073c8e5f90 [logging/documentation] Remove reference to AcceptToMemoryPool from error string (John Newbery) 4c24142b1ec121623f81ba644d77341bc1bd88dd [validation] Remove comment about AcceptToMemoryPool() (John Newbery) 5759fd12b8d5937e9187fa33489a95b1d8e6d1e5 [test] Don't set bypass_limits to true in txvalidation_tests.cpp (John Newbery) 497c9e29640858bb3beb20089c2d4f9e133c7e42 [test] Don't set bypass_limits to true in txvalidationcache_tests.cpp (John Newbery) Pull request description: Similarly to how #18698 added `ProcessNewBlock()` and `ProcessNewBlockHeaders()` methods to the `ChainstateManager` class, this PR adds a new `ProcessTransaction()` method. Code outside validation no longer calls `AcceptToMemoryPool()` directly, but calls through the higher-level `ProcessTransaction()` method. Advantages: - The interface is simplified. Calling code no longer needs to know about the active chainstate or mempool object, since `AcceptToMemoryPool()` can only ever be called for the active chainstate, and that chainstate knows which mempool it's using. We can also remove the `bypass_limits` argument, since that can only be used internally in validation. - responsibility for calling `CTxMemPool::check()` is removed from the callers, and run automatically by `ChainstateManager` every time `ProcessTransaction()` is called. ACKs for top commit: lsilva01: tACK 0fdb619 on Ubuntu 20.04 theStack: Code-review ACK 0fdb619aaf1d62598263361a6082d182be1af792 ryanofsky: Code review ACK 0fdb619aaf1d62598263361a6082d182be1af792. Only changes since last review: splitting & joining commits, adding more explanations to commit messages, tweaking MEMPOOL_ERROR string, fixing up argument name comments. Tree-SHA512: 0b395c2e3ef242f0d41d47174b1646b0a73aeece38f1fe29349837e6fb832f4bf8d57e1a1eaed82a97c635cfd59015a7e07f824e0d7c00b2bee4144e80608172
2021-11-03[refactor] Don't call AcceptToMemoryPool() from outside validation.cppJohn Newbery
2021-10-28[validation/rpc] cache + use vsize calculated in PreChecksglozow
This is not only cleaner but also helps make sure we are always using the virtual size measure that includes the sigop weight heuristic (which is the vsize the mempool would return).
2021-09-30[MOVEONLY] consensus: move amount.h into consensusfanquake
Move amount.h to consensus/amount.h. Renames, adds missing and removes uneeded includes.
2021-09-24refactor: minor styling, prefer snake case and same line ifMichael Dietz
2021-09-24refactor: share logic between ScriptPubKeyToUniv and ScriptToUnivMichael Dietz
2021-09-24rpc: remove deprecated addresses and reqSigs from rpc outputsMichael Dietz
2021-09-21doc: Fix RPC result documentationMarcoFalke
2021-08-05misc package validation doc improvementsglozow
2021-07-28Merge bitcoin/bitcoin#22528: refactor: move GetTransaction to ↵MarcoFalke
node/transaction.cpp f685a13bef0418663015ea6d8f448f075510c0ec doc: GetTransaction()/getrawtransaction follow-ups to #22383 (John Newbery) abc57e1f0882a1a2bb20474648419979af6e383d refactor: move `GetTransaction(...)` to node/transaction.cpp (Sebastian Falbesoner) Pull request description: ~This PR is based on #22383, which should be reviewed first~ (merged by now). In [yesterday's PR review club session to PR 22383](https://bitcoincore.reviews/22383), the idea of moving the function `GetTransaction(...)` from src/validation.cpp to src/node/transaction.cpp came up. With this, the circular dependency "index/txindex -> validation -> index/txindex" is removed (see change in `lint-circular-dependencies.sh`). Thanks to jnewbery for suggesting and to sipa for providing historical background. Relevant IRC log: ``` 17:52 <jnewbery> Was anyone surprised that GetTransaction() is in validation.cpp? It seems to me that node/transaction.cpp would be a more appropriate place for it. 17:53 <raj_> jnewbery, +1 17:53 <stickies-v> agreed! 17:54 <glozow> jnewbery ya 17:54 <jnewbery> seems weird that validation would call into txindex. I wonder if we remove this function, then validation would no longer need to #include txindex 17:54 <sipa> GetTransaction predates node/transaction.cpp, and even the generic index framework itself :) 17:55 <sipa> (before 0.8, validation itself used the txindex) 17:55 <jnewbery> (and GetTransaction() seems like a natural sibling to BroadcastTransaction(), which is already in node/transaction.cpp) 17:55 <jnewbery> sipa: right, this is not meant as a criticism of course. Just wondering if we can organize things a bit more rationally now that we have better separation between things. 17:55 <sipa> jnewbery: sure, just providing background 17:56 <sipa> seems very reasonable to move it elsewhere now ``` The commit should be trivial to review with `--color-moved`. ACKs for top commit: jnewbery: Code review ACK f685a13bef0418663015ea6d8f448f075510c0ec rajarshimaitra: tACK https://github.com/bitcoin/bitcoin/pull/22528/commits/f685a13bef0418663015ea6d8f448f075510c0ec mjdietzx: crACK f685a13bef0418663015ea6d8f448f075510c0ec LarryRuane: Code review, test ACK f685a13bef0418663015ea6d8f448f075510c0ec Tree-SHA512: 0e844a6ecb1be04c638b55bc4478c2949549a4fcae01c984eee078de74d176fb19d508fc09360a62ad130677bfa7daf703b67870800e55942838d7313246248c
2021-07-22doc: GetTransaction()/getrawtransaction follow-ups to #22383John Newbery
2021-07-22Merge bitcoin/bitcoin#22383: rpc: Prefer to use txindex if available for ↵MarcoFalke
GetTransaction 78f4c8b98eada337346ffb206339c3ebae4ff43b prefer to use txindex if available for GetTransaction (Jameson Lopp) Pull request description: Fixes #22382 Motivation: prevent excessive disk reads if txindex is enabled. Worth noting that this could be argued to be less of a bug and more of an issue of undefined behavior. If a user calls GetTransaction with the wrong block hash, what should happen? ACKs for top commit: jonatack: ACK 78f4c8b98eada337346ffb206339c3ebae4ff43b theStack: Code review ACK 78f4c8b98eada337346ffb206339c3ebae4ff43b LarryRuane: tACK 78f4c8b98eada337346ffb206339c3ebae4ff43b luke-jr: utACK 78f4c8b98eada337346ffb206339c3ebae4ff43b jnewbery: utACK 78f4c8b98eada337346ffb206339c3ebae4ff43b rajarshimaitra: Code review ACK https://github.com/bitcoin/bitcoin/commit/78f4c8b98eada337346ffb206339c3ebae4ff43b lsilva01: Code Review ACK and Tested ACK https://github.com/bitcoin/bitcoin/pull/22383/commits/78f4c8b98eada337346ffb206339c3ebae4ff43b on Ubuntu 20.04 Tree-SHA512: af7db5b98cb2ae4897b28476b2fa243bf7e6f850750d9347062fe8013c5720986d1a3c808f80098e5289bd84b085de03c81a44e584dc28982f721c223651bfe0
2021-07-12fix incorrect testmempoolaccept docglozow
2021-07-03prefer to use txindex if available for GetTransactionJameson Lopp
Fixes #22382
2021-06-12Add support for SIGHASH_DEFAULT in RPCs, and make it defaultPieter Wuille
For non-Taproot signatures, this is interpreted as SIGHASH_ALL.
2021-06-12Construct and use PrecomputedTransactionData in PSBT signingPieter Wuille
2021-06-02[refactor] comment/naming improvementsglozow
2021-06-02[rpc] reserve space in txnsglozow
2021-05-24[rpc] allow multiple txns in testmempoolacceptglozow
Only allow "packages" with no conflicts, sorted in order of dependency, and no more than 25 for now. Note that these groups of transactions don't necessarily need to adhere to some strict definition of a package or have any dependency relationships. Clients are free to pass in a batch of 25 unrelated transactions if they want to.
2021-05-20Merge bitcoin/bitcoin#21913: rpc: RPCHelpMan fixesMarcoFalke
6e2eb0d63b42288c11a65d585d487108643888d0 rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) (Karl-Johan Alm) 4983f4cba44c4ffaa4972fdede7cf6fcf8caec00 rpc/createwallet: omitted named arguments (Karl-Johan Alm) dc4db23b30b4bc7884bb28630b2b24edd81c1799 rpc: address:amount dictionaries are OBJ_USER_KEYS (Karl-Johan Alm) c8cf0a3d513b8c892f1ae16b8c0cda184064a07b rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary (Karl-Johan Alm) eb4fb7e507b583bd4ae8d1e3747f41616c782ded rpc/gettxoutsetinfo: hash_or_height is a named argument (Karl-Johan Alm) Pull request description: This is a follow-up to #21897, and I believe covers the remaining cases, at least that I could find. Edited to remove unrelated information about a side project. ACKs for top commit: laanwj: Documentation diff ACK 6e2eb0d63b42288c11a65d585d487108643888d0 promag: Code review ACK 6e2eb0d63b42288c11a65d585d487108643888d0. Tree-SHA512: d26f6e074e13d64bbca2a114a0adc7f905d47d238c4e9bc49f70ca0b775afbebf9879fc3794ab29dc316a6dbd00ba8cbeb01197e236ee4ab2e9854db25f23f04
2021-05-11rpc: address:amount dictionaries are OBJ_USER_KEYSKarl-Johan Alm
2021-05-11Merge bitcoin/bitcoin#21752: doc: Clarify that feerates are per virtual sizeMarcoFalke
fae196147bae11202c0d54543dc12ba5d92ab0cc doc: Clarify that feerates are per virtual size (MarcoFalke) fa83e95ac6f318caa38016a08fa4e402c3b05833 scripted-diff: Clarify that feerates are per virtual size (MarcoFalke) Pull request description: By implementing segwit, it is already clear that all feerates in Bitcoin Core are denoted in (amount/virtual size). Though, there is inconsistency, as some places use kvB, some use kB. Thus, replace all with "kvB". See also commit 6da3afbaee5809ebf6d88efaa3958c505c2d71c7, which did the replacement for wallet RPCs. ACKs for top commit: ryanofsky: Code review ACK fae196147bae11202c0d54543dc12ba5d92ab0cc. Checked instances where units were being added in the second commit and they all looked right. Tree-SHA512: ab70d13cde7d55c1ac931bddc2b45aa218fc75ef46cb6ea9e5a30b1d4dbf27889c2b6357299a6c5427912443a46ec3592a4809dae335e03162bd2120a0f7f8ad