aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
AgeCommit message (Collapse)Author
2018-12-07rpc: Avoid creating non-standard raw transactionsMarcoFalke
Github-Pull: #14890 Rebased-From: fa4c8679ed94f215ce895938f7c3c169a2ce101e
2018-12-05fix converttopsbt permitsigdata arg, add basic testGregory Sanders
Github-Pull: #14356 Rebased-From: 88a79cb436b30b39d37d139da723f5a31e9d161b
2018-12-03Simplify arguments to SignPSBTInputGlenn Willen
Remove redundant arguments to SignPSBTInput -- since it needs several bits of the PartiallySignedTransaction, pass in a reference instead of doing it piecemeal. This saves us having to pass in both a PSBTInput and its index, as well as having to pass in the CTransaction. Also avoid redundantly passing the sighash_type, which is contained in the PSBTInput already. Github-Pull: #14588 Rebased-From: 0f5bda2bd941686620ef0eb90bd7ed973cc7ef73
2018-12-03Add bool PSBTInputSignedGlenn Willen
Refactor out a "PSBTInputSigned" function to check if a PSBT is signed, for use in subsequent commits. Also improve a related comment. GitHub-Pull: #14588 Rebased-From: 53e6fffb8f5b10f94708d33d667a67cb91c2d09d
2018-12-03More concise conversion of CDataStream to stringGlenn Willen
Use .str() instead of .data() and .size() when converting CDataStream to a string. Uses std::string, avoiding conversion to a C string. Github-Pull: #14588 Rebased-From: fe5d22bc676f158e8d567d71edb3451118759d62
2018-11-29Bugfix: RPC: Add address_type named param for createmultisigLuke Dashjr
Github-Pull: #14596 Rebased-From: d8bf1071cf819fb4e848bb832af8199f084e0434
2018-11-28Fix listreceivedbyaddress not taking address as a stringEric Scrivner
Fixes #14173. Add the patch in #14173 and include a regression test. Github-Pull: #14417 Rebased-From: d4d70eda339f6f74390b56edd4021e928bb588a7
2018-10-18[doc] getblocktemplate: use SegWit in exampleSjors Provoost
2018-09-06Adjust TODO linkPieter Wuille
Github-Pull: #14096 Rebased-From: 89709db7a2710456011eac9dcd6a60d5e87b97ae Tree-SHA512: 0bf74e1179bee6e616d8fd2c125411ef30611d9aa3b32412025615a793abbc629a7b6d89a89ef05b11ac3541cc869c0caebba2d00942fdd6ab8d2e98d9b9caca
2018-08-21walletcreatefundedpsbt: remove duplicate replaceable argGregory Sanders
Github-Pull: #13968 Rebased-From: 1f18d7b591ffcc8bb9422a9b728bd9a0d8da6a2a Tree-SHA512: 90391703181db6880a135c60aca792a9e92c4abcad26907cd6cb0a0378593fe45cf995a22ae142ea7de2767c72a9df444e918ff15e460ce19c0435163917d812
2018-08-21Allow ConstructTransaction to not throw error with 0-input txnGregory Sanders
Github-Pull: #13968 Rebased-From: 2252ec50085c151e7998ca9a30cda6a33ee862b6 Tree-SHA512: 1f9978ee25fbe9bb338af19d81b401fa531d314ac8288cdb21c1bf10459edea50b43e2d5e97c9bb5fe24c8db89363f8233c0a3d96066ed85f7bd6d2eb234aac0
2018-08-13Merge #13918: rpc: Replace median fee rate with feerate percentiles in ↵MarcoFalke
getblockstats 4b7091a842 Replace median fee rate with feerate percentiles (Marcin Jachymiak) Pull request description: Currently, the `medianfeerate` statistic is calculated from the feerate of the middle transaction of a list of transactions sorted by feerate. This PR instead uses the value of the 50th percentile weight unit in the block, and also calculates the feerate at the 10th, 25th, 75th, and 90th percentiles. This more accurately corresponds with what is generally meant by median feerate. Tree-SHA512: 59255e243df90d7afbe69839408c58c9723884b8ab82c66dc24a769e89c6d539db1905374a3f025ff28272fb25a0b90e92d8101103e39a6d9c0d60423a596714
2018-08-11Replace median fee rate with feerate percentilesMarcin Jachymiak
Removes medianfeerate result from getblockstats. Adds feerate_percentiles which give the feerate of the 10th, 25th, 50th, 75th, and 90th percentile weight unit in the block.
2018-08-09Use pushKV in some new PSBT RPCs.Daniel Kraft
Most of the code uses UniValue::pushKV where appropriate, but some new RPC code related to PSBTs did not.
2018-08-08Merge #13780: 0.17: Pre-branch maintenanceWladimir J. van der Laan
3fc20632a3ad30809356a58d2cf0ea4a4ad4cec3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot) 2b6a2f4a28792f2fe9dc1be843b1ff1ecae35e8a Regenerate manpages (DrahtBot) eb7daf4d600eeb631427c018a984a77a34aca66e Update copyright headers to 2018 (DrahtBot) Pull request description: Some trivial maintenance to avoid having to do it again after the 0.17 branch off. (The scripts to do this are in `./contrib/`) Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-01Merge #13697: Support output descriptors in scantxoutsetWladimir J. van der Laan
f6b7fc349ccf9cfbeb7e91e19c20e2a2fcc9026f Support h instead of ' in hardened descriptor paths (Pieter Wuille) fddea672eb8f63012f2e9ce04fa477e5d4140750 Add experimental warning to scantxoutset (Jonas Schnelli) 6495849bfd362d6a2f128bac5982fa9e3e2e3396 [QA] Extend tests to more combinations (Pieter Wuille) 1af237faefc316bd708e25d6901ee6f17b706e57 [QA] Add xpub range tests in scantxoutset tests (Jonas Schnelli) 151600bb4972f7bab4ed4a03d1f67c38e081fefe Swap in descriptors support into scantxoutset (Pieter Wuille) 0652c3284fe12941b28624dbbf5e0862c5d0dbc3 Descriptor tests (Pieter Wuille) fe8a7dcd78cfeedc9a7c705e91384f793822912b Output descriptors module (Pieter Wuille) e54d76044b3a2c625e53f2116c5f6a7c40105d5d Add simple FlatSigningProvider (Pieter Wuille) 29943a904a11607787d28b1f4288f500bd076dde Add more methods to Span class (Pieter Wuille) Pull request description: As promised, here is an implementation of my output descriptor concept (https://gist.github.com/sipa/e3d23d498c430bb601c5bca83523fa82) and integration within the `scantxoutset` RPC that was just added through #12196. It changes the RPC to use descriptors for everything; I hope the interface is simple enough to encompass all use cases. It includes support for P2PK, P2PKH, P2WPKH, P2SH, P2WSH, multisig, xpubs, xprvs, and chains of keys - combined in every possible way. Tree-SHA512: 63b54a96e7a72f5b04a8d645b8517d43ecd6a65a41f9f4e593931ce725a8845ab0baa1e9db6a7243190d8ac841f6e7e2f520d98c539312d78f7fd687d2c7b88f
2018-07-27Support h instead of ' in hardened descriptor pathsPieter Wuille
2018-07-27Add experimental warning to scantxoutsetJonas Schnelli
2018-07-27Swap in descriptors support into scantxoutsetPieter Wuille
2018-07-27Return void instead of bool for functions that cannot failpracticalswift
* CBlockTreeDB::ReadReindexing(...) * CChainState::ResetBlockFailureFlags(...) * CTxMemPool::addUnchecked(...) * CWallet::LoadDestData(...) * CWallet::LoadKeyMetadata(...) * CWallet::LoadScriptMetadata(...) * CWallet::LoadToWallet(...) * CWallet::SetHDChain(...) * CWallet::SetHDSeed(...) * RemoveLocal(...) * SetMinVersion(...) * StartHTTPServer(...) * StartRPC(...) * TorControlConnection::Disconnect(...)
2018-07-27Update copyright headers to 2018DrahtBot
2018-07-22Merge #12764: doc: Remove field in getblocktemplate help that has never been ↵MarcoFalke
used. ac8a1d092e [RPC] Remove field in getblocktemplate help that has never been used (Conor Scott) Pull request description: [BIP 22 - getblocktemplate](https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki#Transactions%20Object%20Format) specifies an optional flag, `required` if the transaction must be in the block. Luke's implementation #936 did not include this flag, and it was later added to the help description in #3246 (more than a year later) but the field was still never actually implemented. As far as I can tell, bitcoin core would have never actually included this in a `getblocktemplate` call, so it seems logical to remove it from the help description. If I am missing something or this is considered harmless - I can close the PR. Tree-SHA512: f25dda51cc4e1512aff69309be04e3053bdccc1cf03c8d58e8866aa1fdf9d86cc57df872e85528351fc8a8d6d64a8f46a36c513680834762d854f368fbeb0f44
2018-07-20Merge #9662: Add createwallet "disableprivatekeys" option: a sane mode for ↵Wladimir J. van der Laan
watchonly-wallets a3fa4d6a6acf19d640a1d5879a00aa1f059e2380 QA: Fix bug in -usecli logic that converts booleans to non-lowercase strings (Jonas Schnelli) 4704e5f074e57782d058404a594a7313cf170cf0 [QA] add createwallet disableprivatekey test (Jonas Schnelli) c7b8f343e99d9d53ea353ddce9a977f1886caf30 [Qt] Disable creating receive addresses when private keys are disabled (Jonas Schnelli) 2f15c2bc20d583b4c1788da78c9c635c36e03ed0 Add disable privatekeys option to createwallet (Jonas Schnelli) cebefba0855cee7fbcb9474b34e6779369e8e9ce Add option to disable private keys during internal wallet creation (Jonas Schnelli) 9995a602a639b64a749545b7c3bafbf67f97324f Add facility to store wallet flags (64 bits) (Jonas Schnelli) Pull request description: This mode ('createwallet {"disableprivatekeys": true}') is intended for a sane pure watch-only mode, ideal for a use-case where one likes to use Bitcoin-Core in conjunction with a hardware-wallet or another solutions for cold-storage. Since we have support for custom change addresses in `fundrawtransaction`, pure watch-only wallets including coin-selection are possible and do make sense for some use cases. This new mode disables all forms of private key generation and ensure that no mix between hot and cold keys are possible. Tree-SHA512: 3ebe7e8d54c4d4e5f790c348d4c292d456f573960a5b04d69ca5ef43a9217c7e7671761c6968cdc56f9a8bc235f3badd358576651af9f10855a0eb731f3fc508
2018-07-18Merge #13557: BIP 174 PSBT Serializations and RPCsWladimir J. van der Laan
020628e3a4e88e36647eaf92bac4b3552796ac6a Tests for PSBT (Andrew Chow) a4b06fb42eb0ad94e562ca839391b57e69285136 Create wallet RPCs for PSBT (Andrew Chow) c27fe419efb3b6588c400d764122ffb33375e028 Create utility RPCs for PSBT (Andrew Chow) 8b5ef2793748065727a9a2498805ae5b269dcb4f SignPSBTInput wrapper function (Andrew Chow) 58a8e28918025c28f19ba19cbaa4a72374162942 Refactor transaction creation and transaction funding logic (Andrew Chow) e9d86a43ad8b1ab83b324e9a7a64c43a61337501 Methods for interacting with PSBT structs (Andrew Chow) 12bcc64f277f642ece03c25653e726f2276f0d51 Add pubkeys and whether input was witness to SignatureData (Andrew Chow) 41c607f09badb2c3ed58ff6fb17a8ebbef2cdabd Implement PSBT Structures and un/serialization methods per BIP 174 (Andrew Chow) Pull request description: This Pull Request fully implements the [updated](https://github.com/bitcoin/bips/pull/694) BIP 174 specification. It is based upon #13425 which implements the majority of the signing logic. BIP 174 specifies a binary transaction format which contains the information necessary for a signer to produce signatures for the transaction and holds the signatures for an input while the input does not have a complete set of signatures. This PR contains structs for PSBT, serialization, and deserialzation code. Some changes to `SignatureData` have been made to support detection of UTXO type and storing public keys. *** Many RPCs have been added to handle PSBTs. `walletprocesspsbt` takes a PSBT format transaction, updates the PSBT with any inputs related to this wallet, signs, and finalizes the transaction. There is also an option to not sign and just update. `walletcreatefundedpsbt` creates a PSBT from user provided data in the same form as createrawtransaction. It also funds the transaction and takes an options argument in the same form as `fundrawtransaction`. The resulting PSBT is blank with no input or output data filled in. It is analogous to a combination of `createrawtransaction` and `fundrawtransaction` `decodepsbt` takes a PSBT and decodes it to JSON. It is analogous to `decoderawtransaction` `combinepsbt` takes multiple PSBTs for the same tx and combines them. It is analogous to `combinerawtransaction` `finalizepsbt` takes a PSBT and finalizes the inputs. If all inputs are final, it extracts the network serialized transaction and returns that instead of a PSBT unless instructed otherwise. `createpsbt` is like `createrawtransaction` but for PSBTs instead of raw transactions. `convertpsbt` takes a network serialized transaction and converts it into a psbt. The resulting psbt will lose all signature data and an explicit flag must be set to allow transactions with signature data to be converted. *** This supersedes #12136 Tree-SHA512: 1ac7a79e5bc669933f0a6fcc93ded55263fdde9e8c144a30266b13ef9f62aacf43edd4cbca1ffbe003090b067e9643c9298c79be69d7c1b10231b32acafb6338
2018-07-17Merge #12196: Add scantxoutset RPC methodWladimir J. van der Laan
be98b2d9a8fcb5f0e29ea88f026d604442fe984c [QA] Add scantxoutset test (Jonas Schnelli) eec7cf7b33cafac6a969bce38905cbacda56b1a5 scantxoutset: mention that scanning by address will miss P2PK txouts (Jonas Schnelli) 94d73d32abe927e74271a7b3eac7ba56658a535e scantxoutset: support legacy P2PK script type (Jonas Schnelli) 892de1dfea283a5d6ac18b8c74b57f61a920c762 scantxoutset: add support for scripts (Jonas Schnelli) 78304941f771b8bd918deddd37d01bc8f21873e1 Blockchain/RPC: Add scantxoutset method to scan UTXO set (Jonas Schnelli) 90485755115424ed9ea70206f54da2b13777fa6c Add FindScriptPubKey() to search the UTXO set (Jonas Schnelli) Pull request description: Alternative to #9152. This takes `<n>` pubkeys and optionally `<n>` xpubs (together with a definable lookup windows where the default is 0-1000) and looks up common scripts in the UTXO set of all given or derived keys. The output will be an array similar to `listunspent`. That array is compatible with `createrawtransaction` as well as with `signrawtransaction`. This makes it possible to prepare sweeps and have them signed in a secure (cold) space. Tree-SHA512: a2b22a117cf6e27febeb97e5d6fe30184926d50c0c7cbc77bb4121f490fed65560c52f8eac67a9720d7bf8f420efa42459768685c7e7cc03722859f51a5e1e3b
2018-07-16Create wallet RPCs for PSBTAndrew Chow
walletprocesspsbt takes a PSBT format transaction, updates the PSBT with any inputs related to this wallet, signs, and finalizes the transaction. There is also an option to not sign and just update. walletcreatefundedpsbt creates a PSBT from user provided data in the same form as createrawtransaction. It also funds the transaction and takes an options argument in the same form as fundrawtransaction. The resulting PSBT is blank with no input or output data filled in.
2018-07-16Create utility RPCs for PSBTAndrew Chow
decodepsbt takes a PSBT and decodes it to JSON combinepsbt takes multiple PSBTs for the same tx and combines them. finalizepsbt takes a PSBT and finalizes the inputs. If all inputs are final, it extracts the network serialized transaction and returns that instead of a PSBT unless instructed otherwise. createpsbt is like createrawtransaction but for PSBTs instead of raw transactions. convertpsbt takes a network serialized transaction and converts it into a psbt. The resulting psbt will lose all signature data and an explicit flag must be set to allow transactions with signature data to be converted.
2018-07-15scantxoutset: mention that scanning by address will miss P2PK txoutsJonas Schnelli
2018-07-15scantxoutset: support legacy P2PK script typeJonas Schnelli
2018-07-15scantxoutset: add support for scriptsJonas Schnelli
2018-07-15Blockchain/RPC: Add scantxoutset method to scan UTXO setJonas Schnelli
2018-07-13Merge #13072: Update createmultisig RPC to support segwitPieter Wuille
f40b3b82df [tests] functional test for createmultisig RPC (Anthony Towns) b9024fdda3 segwit support for createmultisig RPC (Anthony Towns) d58055d25f Move AddAndGetDestinationForScript from wallet to outputype module (Anthony Towns) 9a44db2e46 Add outputtype module (Anthony Towns) Pull request description: Adds an "address_type" parameter that accepts "legacy", "p2sh-segwit", and "bech32" to choose the type of address created. Defaults to "legacy" rather than the value of the `-address-type` option for backwards compatibility. As part of implementing this, OutputType is moved from wallet into its own module, and `AddAndGetDestinationForScript` is changed to apply to a `CKeyStore` rather than a wallet, and to invoke `keystore.AddCScript(script)` itself rather than expecting the caller to have done that. Fixes #12502 Tree-SHA512: a08c1cfa89976e4fd7d29caa90919ebd34a446354d17abb862e99f2ee60ed9bc19d8a21a18547c51dc3812cb9fbed86af0bef2f1e971f62bf95cade4a7d86237
2018-07-13Refactor transaction creation and transaction funding logicAndrew Chow
In preparation for more create transaction and fund transcation RPCs, refactor the transaction creation and funding logic into separate functions.
2018-07-12Add disable privatekeys option to createwalletJonas Schnelli
2018-07-12Add FindScriptPubKey() to search the UTXO setJonas Schnelli
2018-07-10Merge #13547: Make signrawtransaction* give an error when amount is needed ↵Wladimir J. van der Laan
but missing 685d1d8115f61b15115d80523dd8273f0a816534 [tests] Check signrawtransaction* errors on missing prevtx info (Anthony Towns) a3b065b51fb333d976108a1fe34b7f663fd67285 Error on missing amount in signrawtransaction* (Anthony Towns) Pull request description: Signatures using segregated witness commit to the amount being spent, so that value must be passed into signrawtransactionwithkey and signrawtransactionwithwallet. This ensures an error is issued if that doesn't happen, rather than just assuming the value is 0 and producing a signature that is almost certainly invalid. Based on Ben Woosley's #12458, Fixes: #12429. Tree-SHA512: 8e2ff89d5bcf79548e569210af0d850028bc98d86c149b92207c9300ab1d63664a7e2b222c1be403a15941aa5cf36ccc3c0d570ee1c1466f3496b4fe06c17e11
2018-07-09Merge #13452: rpc: have verifytxoutproof check the number of txns in proof ↵Wladimir J. van der Laan
structure d280617bf569f84457eaea546541dc74c67cd1e4 [qa] Add a test for merkle proof malleation (Suhas Daftuar) ed82f1700006830b6fe34572b66245c1487ccd29 have verifytxoutproof check the number of txns in proof structure (Gregory Sanders) Pull request description: Recent publication of a weakness in Bitcoin's merkle tree construction demonstrates many SPV applications vulnerable to an expensive to pull off yet still plausible attack: https://bitslog.wordpress.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/ This change would at least allow `verifytxoutproof` to properly validate that the proof matches a known block, with known number of transactions any time after the full block is processed. This should neuter the attack entirely. The negative is that a header-only processed block/future syncing mode would cause this to fail until the node has imported the data required. related: #13451 `importprunedfunds` needs this check as well. Can expand it to cover this if people like the idea. Tree-SHA512: 0682ec2b622a38b29f3f635323e0a8b6fc071e8a6fd134c954579926ee7b516e642966bafa667016744ce49c16e19b24dbc8801f982a36ad0a6a4aff6d93f82b
2018-07-10segwit support for createmultisig RPCAnthony Towns
2018-07-05Merge #13425: Moving final scriptSig construction from CombineSignatures to ↵Wladimir J. van der Laan
ProduceSignature (PSBT signer logic) b81560029 Remove CombineSignatures and replace tests (Andrew Chow) ed94c8b55 Replace CombineSignatures with ProduceSignature (Andrew Chow) 0422beb9b Make SignatureData able to store signatures and scripts (Andrew Chow) b6edb4f5e Inline Sign1 and SignN (Andrew Chow) Pull request description: Currently CombineSignatures is used to create the final scriptSig or an input. However ProduceSignature is capable of doing this itself. Using both CombineSignatures and ProduceSignature results in code duplication which is unnecessary. To move the scriptSig construction to ProduceSignatures, the SignatureData class contains two maps to hold pubkeys mapped to signatures, and script ids mapped to scripts. DataFromTransaction is extended to be able to extract signatures, their public keys, and scripts from existing ScriptSigs. The SignaureData are then passed down to SignStep which can use the aforementioned maps to get the signatures, pubkeys, and scripts that it needs, falling back to the actual SigningProvider and SignatureCreator if the data are not available in the SignatureData. Additionally, Sign1 and SignN have been removed and their functionality inlined into SignStep since Sign1 is really just a wrapper around CreateSig. Since ProduceSignature can produce the final scriptSig or scriptWitness by using SignatureData which has extracted data from the transaction, CombineSignatures is unnecessary as ProduceSignature is able to replicate all of CombineSignatures' functionality. This also furthers BIP 174 support and begins moving towards a BIP 174 style backend. The tests have also been updated to use the new combining methodology. Tree-SHA512: 78cd58a4ebe37f79229bd5eee2958a0bb45cd7f36d0e993eee13ff685b3665dd76ef2dfd5f47d34678995bb587f5594100ee5f6c09b1c69ee96d3684d470d01e
2018-07-04Merge #13235: Break circular dependency: init -> * -> init by extracting ↵Wladimir J. van der Laan
shutdown.h 1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley) e62fdfeea Drop unused init.h includes (Ben Woosley) Pull request description: Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`. Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
2018-07-04Merge #13491: Improve handling of INVALID in IsMineWladimir J. van der Laan
bb582a59c Add P2WSH destination helper and use it instead of manual hashing (Pieter Wuille) eaba1c111 Add additional unit tests for invalid IsMine combinations (Pieter Wuille) e6b9730c4 Do not expose invalidity from IsMine (Pieter Wuille) Pull request description: This improves the handling of INVALID in IsMine: * Extra INVALID conditions were added to `IsMine` (following https://github.com/bitcoin/bitcoin/pull/13142/files#r185349057), but these were untested. Add unit tests for them. * In https://github.com/bitcoin/bitcoin/pull/13142#issuecomment-386396975 it was suggested to merge `isInvalid` into the return status. This PR takes a different approach, and removes the `isInvalid` entirely. It was only ever used inside tests, as normal users of IsMine don't care about the reason for non-mine-ness, only whether it is or not. As the unit tests are extensive enough, it seems sufficient to have a black box text (with tests for both compressed and uncompressed keys). Some addition code simplification is done as well. Tree-SHA512: 3267f8846f3fa4e994f57504b155b0e1bbdf13808c4c04dab7c6886c2c0b88716169cee9c5b350513297e0ca2a00812e3401acf30ac9cde5d892f9fb59ad7fef
2018-07-03Replace CombineSignatures with ProduceSignatureAndrew Chow
Instead of using CombineSignatures to create the final scriptSig or scriptWitness of an input, use ProduceSignature itself. To allow for ProduceSignature to place signatures, pubkeys, and scripts that it does not know about, we pass down the SignatureData to SignStep which pulls out the information that it needs from the SignatureData.
2018-07-03Make SignatureData able to store signatures and scriptsAndrew Chow
In addition to having the scriptSig and scriptWitness, have SignatureData also be able to store just the signatures (pubkeys mapped to sigs) and scripts (script ids mapped to scripts). Also have DataFromTransaction be able to extract signatures and scripts from the scriptSig and scriptWitness of an input to put them in SignatureData. Adds a new SignatureChecker which takes a SignatureData and puts pubkeys and signatures into it when it successfully verifies a signature. Adds a new field in SignatureData which stores whether the SignatureData was complete. This allows us to also update the scriptSig and scriptWitness to the final one when updating a SignatureData with another one.
2018-07-02Delete double semicolon in wallet.cpp and misc.cppMatteo Sumberaz
2018-06-28Error on missing amount in signrawtransaction*Anthony Towns
Signatures using segregated witness commit to the amount being spent, so that value must be passed into signrawtransactionwithkey and signrawtransactionwithwallet. This ensures an error is issued if that doesn't happen, rather than just assuming the value is 0 and producing a signature that is almost certainly invalid.
2018-06-25Break circular dependency: init -> * -> init by extracting shutdown.hBen Woosley
Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `AbortShutdown` for setting it to `false`. Note I originally called `AbortShutdown` `CancelShutdown` but that name was already taken by winuser.h https://travis-ci.org/bitcoin/bitcoin/jobs/386913329 This change also triggered a build error in bench. Fixing it required moving LIBBITCOIN_SERVER after LIBBITCOIN_WALLET in bench_bench_bitcoin_LDADD To make server definitions in src/net.cpp available to wallet methods in src/wallet/wallet.cpp. Specifically, solving: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `CWalletTx::RelayWalletTransaction(CConnman*)': wallet.cpp:(.text+0x3f0e): undefined reference to `CConnman::NodeFullyConnected(CNode const*)' collect2: error: ld returned 1 exit status https://travis-ci.org/bitcoin/bitcoin/jobs/392133581 Need for remaining init.h includes confirmed via a thorough search with a more specific regex: \bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h
2018-06-25Drop unused init.h includesBen Woosley
These were entirely unused, as based on successful compilation and a grep for: \bStartShutdown\(\)|\bShutdownRequested\(\)|\bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h
2018-06-24Merge #13480: Avoid copies in range-for loops and add a warning to detect themWladimir J. van der Laan
d92204c900d55ebaf2af5c900162b3c2c8c296e2 build: add warning to detect hidden copies in range-for loops (Cory Fields) 466e16e0e8523909f9968c5823691b1d4a3d8175 cleanup: avoid hidden copies in range-for loops (Cory Fields) Pull request description: Following-up on #13241, which was itself a follow-up of #12169. See title. Fixing these would otherwise be a continuous process, adding the warning should keep them from cropping up. Note that the warning seems to be Clang-only for now. Tree-SHA512: ccfb769c3128b3f92c95715abcf21ee2496fe2aa384f80efead1529a28eeb56b98995b531b49a089f8142601389e63f7bb935963d724eacde4f5e1b4a024934b
2018-06-19Merge #13439: rpc: Avoid "duplicate" return value for invalid submitblockJonas Schnelli
f74894480 Only set fNewBlock to true in AcceptBlock when we write to disk (Matt Corallo) fa6e49731 rpc: Avoid "duplicate" return value for invalid submitblock (MarcoFalke) Pull request description: This is #13395 with one more commit tacked on. MarcoFalke got tired of dealing with the stupidity of fixing a return code with too many rounds of review (not that I blame him). Honestly we should probably have no return whatsoever, but for now, this fixes it (as well as nLastBlockTime for eviction purposes). Original description: When `submitblock` of an invalid block, the return value should not be `"duplicate"`. This is only seen when the header was previously found (denoted by the incorrectly named boolean `fBlockPresent`). Fix this bug by removing `fBlockPresent`. Tree-SHA512: 0ce3092655d5d904b4c8c5ff7479f73ce387144a738f20472b8af132564005c6db5594ae366e589508f6258506ee7a28b1c7995a83a8328b334f99316006bf2d
2018-06-17Add P2WSH destination helper and use it instead of manual hashingPieter Wuille