aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
AgeCommit message (Collapse)Author
2019-07-05signrawtransactionwithkey: report error when missing ↵Anthony Towns
redeemScript/witnessScript param Github-Pull: #16250 Rebased-From: 01174596e69568c434198a86f54cb9ea6740e6c2
2019-06-18rpc: bugfix: Properly use iswitness in converttopsbtMarcoFalke
Also explain the param in all RPCs Github-Pull: #15899 Rebased-From: fa499b5f027f77c0bf13699852c8c06f78e27bef
2019-06-18rpc: Switch touched RPCs to IsValidNumArgsMarcoFalke
Github-Pull: #15899 Rebased-From: fa5c5cd141f0265a5693234690ac757b811157d8
2019-06-17Add example 2nd arg to signrawtransactionwithkeyChris Moore
The RPC examples for signrawtransactionwithkey are missing the 2nd parameter. Github-Pull: #16210 Rebased-From: 71fd628adafdeb2a4b343e0d51d7168cdb186312
2019-03-13Fix overflow bug in analyzepsbt fee: CAmount instead of intPieter Wuille
Github-Pull: #15582 Rebased-From: c9963ae8b1a4d26d19c58e18fde9c85783edb788 Tree-SHA512: ed1dcfafb7015de5405112938b04c4009bec3349a8d4e8aca641598ccab31a34c7f16b5045670909fd2e795fc40640a79658ef6b1771e9f21abd0ca759b239b5
2019-03-13rpc: return a number for estimated_feerate in analyzepsbtfanquake
Github-Pull: #15559 Rebased-From: 335931df4a37467299a2ee0ba521ecd5c4e6d39e Tree-SHA512: ebe460e935e33fbbbe725db403654ee65c86a606401e8519e1180551e2ccd43661eb4ad20bf065f2c0c2a8026c3bb3bce796789f8d612e9e197ceb8d541a63a9
2019-03-13doc: correct analysepsbt rpc docfanquake
Github-Pull: #15559 Rebased-From: a4d0fd026b74db034dc8a1fa7efbd4f1dba8cdb9 Tree-SHA512: 43f985ccb1af22e416230b8f351396d1fa677ee4e60f6952962ed37e842f5746df8a58ae7c35d6a7518af4b5974ee753b17ec3578394122584ca10e9ed561268
2019-02-25refactor: Use RPCHelpMan::IsValidNumArgs in getrawtransactionMarcoFalke
2019-02-25doc: Remove misleading hint in getrawtransactionMarcoFalke
2019-02-22Merge #15408: Remove unused TransactionError constantsMarcoFalke
fa9b60c842 Remove unused TransactionError constants (MarcoFalke) Pull request description: Fixup to #14978, which introduced a bunch of unused enum values, such as `UNKNOWN_ERROR`, `ERROR_COUNT` and `TRANSACTION_ERR_LAST`. None of those have a meaning in the context of an `enum class`, where the compiler can infer if all cases have been covered in a switch-case. Also, move the global `::maxTxFee` back to the rpc caller, so it can be set on a per call basis (in the future). Tree-SHA512: 7f1e2d795f1c1278ecd54ddab2b92c2a862f3c637b482d1d008208925befa1c9dd4b3c4bb1bfcbc5ca4b66a41004aaf01ea96ea95236f944250b8a6cf99ff173
2019-02-16Merge #13932: Additional utility RPCs for PSBTWladimir J. van der Laan
540729ef4bf1b6c6da1ec795e441d2ce56a9a58b Implement analyzepsbt RPC and tests (Andrew Chow) 77542cf2a5f8abb97dd46f782c1b0199cc062033 Move PSBT UTXO fetching to a separate method (Andrew Chow) cb40b3abd4514361a024a1e7a1a281da9261261b Figure out what is missing during signing (Andrew Chow) 08f749c9147a5f3fdbbd880e0974b97084429002 Implement joinpsbts RPC and tests (Andrew Chow) 7344a7b9984b99882e136efc8ad48fb31740df93 Implement utxoupdatepsbt RPC and tests (Andrew Chow) Pull request description: This PR adds 3 new utility RPCs for interacting with PSBTs. `utxoupdatepsbt` updates a PSBT with UTXO information from the node. It only works with witness UTXOs because full transactions (as would be needed for non-witness UTXOs) are not available unless txindex is enabled. `joinpsbts` joins the inputs from multiple distinct PSBTs into one PSBT. e.g. if PSBT 1 has inputs 1 and 2, and PSBT 2 has inputs 3 and 4, `joinpsbts` would create a new PSBT with inputs 1, 2, 3, and 4. `analyzepsbt` analyzes a PSBT and determines the current state of it and all of its inputs, and the next step that needs to be done. Tree-SHA512: 3c1fa302201abca76a8901d0c2be7b4ccbce334d989533c215f8b3e50e22f2f018ce6209544b26789f58f5980a253c0655111e1e20d47d5656e0414c64891a5c
2019-02-16Implement analyzepsbt RPC and testsAndrew Chow
2019-02-16Implement joinpsbts RPC and testsAndrew Chow
Adds a joinpsbts RPC which combines multiple distinct PSBTs into one PSBT.
2019-02-16Implement utxoupdatepsbt RPC and testsAndrew Chow
2019-02-15Merge #14021: Import key origin data through descriptors in importmultiMeshCollider
cb3511b9d Add release notes for importing key origin info change (Andrew Chow) 4c75a69f3 Test importing descriptors with key origin information (Andrew Chow) 02d6586d7 Import KeyOriginData when importing descriptors (Andrew Chow) 3d235dff5 Implement a function to add KeyOriginInfo to a wallet (Andrew Chow) eab63bc26 Store key origin info in key metadata (Andrew Chow) 345bff601 Remove hdmasterkeyid (Andrew Chow) bac8c676a Add a method to CWallet to write just CKeyMetadata (Andrew Chow) e7652d3f6 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow) c45415f73 Refactor keymetadata writing to a separate method (Andrew Chow) Pull request description: This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet. In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this. Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
2019-02-14Merge #14481: Add P2SH-P2WSH support to listunspent RPCWladimir J. van der Laan
6ca836ab3abef5a90df0c3c4e4983f328b1afe00 Add release note for listunspent P2WSH change (MeshCollider) 928beae007fc2f951e79ea307a5e983af4cb3acf Add test for P2SH-P2WSH in signrawtransactionwithkey and listunspent (MeshCollider) 314784a60f18424b004e935aa6e41b824e9645b3 Make listunspent and signrawtransaction RPCs support witnessScript (MeshCollider) Pull request description: This is a reworked version of #11708 after #12427 and the `signrawtransaction` split. For a P2WSH address, listunspent should return the witness script, and for a P2SH-P2WSH address, it should also return the inner witness script (because SignTransaction will automatically wrap it in P2SH if required). Includes a test which also tests the behaviour of #12427, and release note. Tree-SHA512: a8e72cf16930312bf48ec47e44a68f8d7e26664043c1b4cc0983eb25aec4087e511188ff9a0f181cd7b8a0c068c60d7f1e7e3f226b79e8c48890039dcf57f7b7
2019-02-14Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp}Andrew Chow
Creates new files util/bip32.h and util/bip32.cpp for containing BIP 32 stuff. Moves FormatKeyPath from descriptor.cpp to util/bip32. Adds a wrapper around it to prepent the 'm' for when just the BIP 32 style keypath is needed.
2019-02-14Remove unused TransactionError constantsMarcoFalke
2019-02-14Merge #14978: Factor out PSBT utilities from RPCs for use in GUI code; ↵MeshCollider
related refactoring. 102faad81 Factor out combine / finalize / extract PSBT helpers (Glenn Willen) 78b9893d0 Remove op== on PSBTs; check compatibility in Merge (Glenn Willen) bd0dbe876 Switch away from exceptions in refactored tx code (Glenn Willen) c6c3d42a7 Move PSBT definitions and code to separate files (Glenn Willen) 81cd95884 Factor BroadcastTransaction out of sendrawtransaction (Glenn Willen) c734aaa15 Split DecodePSBT into Base64 and Raw versions (Glenn Willen) 162ffefd2 Add pf_invalid arg to std::string DecodeBase{32,64} (Glenn Willen) Pull request description: * Move most PSBT definitions into psbt.h. * Move most PSBT RPC utilities into psbt.{h,cpp}. * Move wallet-touching PSBT RPC utilities (FillPSBT) into wallet/psbtwallet.{h,cpp}. * Switch exceptions from JSONRPCError() to new PSBTException class. * Split DecodePSBT into DecodeBase64PSBT (old behavior) and DecodeRawPSBT. * Add one new version of DecodeBase64 utility in strencodings.h (and corresponding DecodeBase32 for completeness). * Factor BroadcastTransaction utility function out of sendrawtransaction RPC handler in rpc/rawtransaction.cpp Note: For those keeping score at home wondering why refactor, this is in anticipation of (and developed in parallel with) a change to actually introduce GUI use of all this stuff, which is already under development and working-ish. Tree-SHA512: 2197c448e657421f430943025357597e7b06c4c377d5d4b2622b9edea52a7193c48843dd731abb3a88ac4023a9c88d211991e0a9b740c22f2e1cbe72adefe390
2019-02-13Make listunspent and signrawtransaction RPCs support witnessScriptMeshCollider
2019-02-11Factor out combine / finalize / extract PSBT helpersGlenn Willen
Refactor the new CombinePSBT, FinalizePSBT, and FinalizeAndExtractPSBT general-purpose functions out of the combinepsbt and finalizepsbt RPCs, for use in the GUI code.
2019-02-11Remove op== on PSBTs; check compatibility in MergeGlenn Willen
Remove the op== on PartiallySignedTransaction, which only checks that the CTransactions are equal. Instead, check this directly in Merge, and return false if the CTransactions are not equal (so the PSBTs cannot be merged.)
2019-02-11Switch away from exceptions in refactored tx codeGlenn Willen
After refactoring general-purpose PSBT and transaction code out of RPC code, for use in the GUI, it's no longer appropriate to throw exceptions. Instead we now return bools for success, and take an output parameter for an error object. We still use JSONRPCError() for the error objects, since only RPC callers actually care about the error codes.
2019-02-11Move PSBT definitions and code to separate filesGlenn Willen
Move non-wallet PSBT code to src/psbt.{h,cpp}, and PSBT wallet code to src/wallet/psbtwallet.{h,cpp}. This commit contains only code movement (and adjustments to includes and Makefile.am.)
2019-02-11Factor BroadcastTransaction out of sendrawtransactionGlenn Willen
Factor out a new BroadcastTransaction function, performing the core work of the sendrawtransaction rpc, so that it can be used from the GUI code. Move it from src/rpc/ to src/node/.
2019-02-11Split DecodePSBT into Base64 and Raw versionsGlenn Willen
Split up DecodePSBT, which both decodes base64 and then deserializes a PartiallySignedTransaction, into two functions: DecodeBase64PSBT, which retains the old behavior, and DecodeRawPSBT, which only performs the deserialization. Add a test for base64 decoding failure.
2019-02-11RPCHelpMan: Check default values are given at compile-timeMarcoFalke
2019-02-11Merge #15337: rpc: Fix for segfault if combinepsbt called with empty inputsMarcoFalke
30d0f7be6e rpc: Fix for segfault if combinepsbt called with empty inputs (benthecarman) Pull request description: Fixes #15300 Tree-SHA512: 25e7b4e6e48d8b0d197f0ab96df308fff33e2110f8929cb48914877fa7f4c4a84f173b1378fdb2dec5d03fe7d6d1aced4b577e55f9fe180d8147d9106ebf543f
2019-02-04rpc: Fix for segfault if combinepsbt called with empty inputsbenthecarman
2019-02-04[Docs] Small updates to getrawtransaction descriptionAmiti Uttarwar
2019-01-30Merge #15159: [RPC] Remove lookup to UTXO set from GetTransactionMarcoFalke
04da9f4834 [RPC] Update getrawtransaction interface (Amiti Uttarwar) Pull request description: - stop checking unspent UTXOs for a transaction when txindex is not enabled, as per conversation here: https://github.com/bitcoin/bitcoin/issues/3220#issuecomment-377458383 - code contributed by sipa Tree-SHA512: aa07353bccc14b81b7803992a25d076d6bc06d15ec7c1b85828dc10aea7e0498d9b49f71783e352ab8a14b0bb2010cfb7835de3dfd1bc6f2323f460449348e66
2019-01-26[RPC] Update getrawtransaction interfaceAmiti Uttarwar
2019-01-25RPCHelpMan: Pass through Result and ExamplesMarcoFalke
2019-01-21Merge #14906: refactor: Make explicit CMutableTransaction -> CTransaction ↵Wladimir J. van der Laan
conversion. b301950df32443e358bc22ca22c6f9ac09d18219 Made expicit constructor CTransaction(const CMutableTransaction &tx). (lucash-dev) faf29dd019efef4b05e8e78885926764134d9c04 Minimal changes to comply with explicit CMutableTransaction -> CTranaction conversion. (lucash-dev) Pull request description: This PR is re-submission of #14156, which was automatically closed by github (glitch?) Original description: This PR makes explicit the now implicit conversion constructor `CTransaction(const CMutableTransaction&)` in `transaction.h`. Minimal changes were made elsewhere to make the code compilable. I'll follow up with other PRs to address individually refactoring functions that should have a `CMutableTransaction` version, or where a `CTransaction` should be reused. The rationale for this change is: - Conversion constructors should not be explicit unless there's a strong reason for it (in the opinion of, for example, https://google.github.io/styleguide/cppguide.html, and https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion. Let me know your take on this). - This particular conversion is very costly -- it implies a serialization plus hash of the transaction. - Even though `CTransaction` and `CMutableTransaction` represent the same data, they have very different use cases and performance properties. - Making it explicit allows for easier reasoning of performance trade-offs. - There has been previous performance issues caused by unneeded use of this implicit conversion. - This PR creates a map for places to look for possible refactoring and performance gains (this benefit still holds if the PR is not merged). Tree-SHA512: 2427462e7211b5ffc7299dae17339d27f8c43266e0895690fda49a83c72751bd2489d4471b3993075a18f3fef25d741243e5010b2f49aeef4a9688b30b6d0631
2018-12-29Merge #14966: docs: fix testmempoolaccept CLI syntaxMarcoFalke
b74a52192b fix testmempoolaccept CLI syntax (1Il1) Pull request description: `testmempoolaccept "hexstring"` will give a "JSON parse error". The correct syntax is `testmempoolaccept \[\"hexstring\"\]` (but seems escaping is not displayed in other areas so leaving backspaces out). Tree-SHA512: ad755147d6db0bd3f2d8481517dab29df755a32b28a3bdb4553b1fddd1940850450d1e9a6c3bd04e4e3faa7bc09aadfd3412b4cd65e61d61ea34452831597967
2018-12-17 Minimal changes to comply with explicit CMutableTransaction -> CTranaction ↵lucash-dev
conversion. This commit makes the minimal changes necessary to fix compilation once CTransaction(const CMutableTransaction &tx) is made explicit. In each case an explicit call `CTransaction(...)` was added. Shouldn't affect behaviour or performance.
2018-12-17clarifying getrawtransaction[time] get help textBen Carman
2018-12-15fix testmempoolaccept CLI syntax1Il1
`testmempoolaccept "hexstring"` will give a "JSON parse error". The correct syntax is `testmempoolaccept \[\"hexstring\"\]` (but seems escaping is not displayed in other areas so leaving backspaces out).
2018-12-10Merge #14877: rpc: Document default values for optional argumentsMarcoFalke
fa0c24c96e rpc: Document default values for optional arguments (MarcoFalke) Pull request description: Tree-SHA512: e1f5ea67d7ac67526ae87bffaeb308a9ad68632e161fe0148cd431a340bb7a30def18f1dbc7e98c6c1c269ac8942fd5d5334c85c48e4fb1cead70a42536b6eef
2018-12-07rpc: Document default values for optional argumentsMarcoFalke
2018-12-06rpc: Avoid creating non-standard raw transactionsMarcoFalke
2018-11-27rpc: Pass argument descriptions to RPCHelpManMarcoFalke
2018-11-26clarify RPC rawtransaction documentationJameson Lopp
2018-11-14Use RPCHelpMan for all RPCsMarcoFalke
2018-11-13Merge #14530: Use RPCHelpMan to generate RPC doc stringsMarcoFalke
fa483e13b3 rpc: Add RPCHelpMan for machine-generated help (MarcoFalke) fa0d36f712 rpc: Include rpc/util.h where needed for RPCHelpMan (MarcoFalke) Pull request description: This introduces a manager for the RPC help generation and demonstrates its use of it in some RPCs. It is the first non-exhaustive step toward #14378 and I will create pull requests for the next steps after this one is merged. Tree-SHA512: 86f68322443ff01cd964aaf0ebe186be63fbebe4c47676cf7a622cc2b5305fd176bd57badfd1bbf788a036812253eb0dead74ecc3b30664c3e0d9392b2248054
2018-11-12Merge #14356: fix converttopsbt permitsigdata arg, add basic testWladimir J. van der Laan
88a79cb436b30b39d37d139da723f5a31e9d161b fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders) Pull request description: The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior. Resolves https://github.com/bitcoin/bitcoin/issues/14355 Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
2018-11-12rpc: Add RPCHelpMan for machine-generated helpMarcoFalke
2018-11-09Merge #14588: Refactor PSBT signing logic to enforce invariant and fix ↵Pieter Wuille
signing bug e13fea975d Add regression test for PSBT signing bug #14473 (Glenn Willen) 565500508a Refactor PSBTInput signing to enforce invariant (Glenn Willen) 0f5bda2bd9 Simplify arguments to SignPSBTInput (Glenn Willen) 53e6fffb8f Add bool PSBTInputSigned (Glenn Willen) 65166d4cf8 New PartiallySignedTransaction constructor from CTransction (Glenn Willen) 4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT (Glenn Willen) fe5d22bc67 More concise conversion of CDataStream to string (Glenn Willen) Pull request description: As discussed in the comments on #14473, I think that bug was caused primarily by failure to adhere to the invariant that a PSBTInput always has exactly one of the two utxo fields present -- an invariant that is already enforced by PSBTInput::IsSane, but which we were temporarily suspending during signing. This refactor repairs the invariant, also fixing the bug. It also simplifies some other code, and removes redundant parameters from some related functions. fixes #14473 Tree-SHA512: cbad3428175e30f9b7bac3f600668dd1a8f9acde16b915d27a940a2fa6d5149d4fbe236d5808fd590fb20a032274c99e8cac34bef17f79a53fdf69a5948c0fd0
2018-11-09rpc: Include rpc/util.h where needed for RPCHelpManMarcoFalke
Just a preparatory commit to add the header to the includes and run clang-format to sort the include lists. Splitting this up into a separate commit makes future scripted-diffs easier.
2018-11-09Merge #14437: Refactor: Start to separate wallet from nodeMarcoFalke
081accb875 Pass chain locked variables where needed (Russell Yanofsky) 79d579f4e1 Remove uses of cs_main in wallet code (Russell Yanofsky) ea961c3d72 Remove direct node->wallet calls in init.cpp (Russell Yanofsky) 8db11dd0b1 Pass chain and client variables where needed (Russell Yanofsky) 7e2e62cf7c Add skeleton chain and client classes (Russell Yanofsky) Pull request description: This creates an incomplete [`Chain`](https://github.com/ryanofsky/bitcoin/blob/pr/wipc-sep/src/interfaces/chain.h) interface in [`src/interfaces/`](https://github.com/ryanofsky/bitcoin/tree/pr/wipc-sep/src/interfaces) and begins to update wallet code to use it. #10973 builds on this, changing the wallet to use the new interface to access chain state, instead of using CBlockIndex pointers and global variables like `chainActive`. Tree-SHA512: 6ef05a4d8ebf57f2ad71835e4d970c9c59e34057e39e48cee76b887492c2fee907e3f6a74a9861e5a9f97cdc6823f4865ebc41ec556ab371ebca1b664c20dbea