aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
AgeCommit message (Collapse)Author
2019-01-08Merge #12153: Avoid permanent cs_main lock in getblockheaderWladimir J. van der Laan
f12e1d0b5117e3688f52a25ed0170d76ecdbf233 rpc: Avoid permanent cs_main lock in getblockheader (João Barbosa) Pull request description: This PR reduces the `cs_main` lock scope in `getblockheader` RPC. Tree-SHA512: bc51f80e15d1b32d3c7886836457f9929706b6aad9841dafce31ffca444281471b21b56192bb50de774184b9377412f815ad8d3d2439049a7e64d2e59c415767
2019-01-07Merge #15057: [rpc] Correct reconsiderblock help text, add testWladimir J. van der Laan
fa38d3df69851212fea7544badadc1c3e5369bf5 [rpc] Correct reconsiderblock help text, add test (MarcoFalke) Pull request description: Rework documentation and test to match the implementation Tree-SHA512: d0adef6b054a341bcc1cb87783a4e4cf9be124ba6812e1ac88246a5e01b2861a8071b12dba880b2b428c37da3fa860bfec3fe3e5fbb7c28696872113faa84a9f
2019-01-04rpc: Avoid permanent cs_main lock in getblockheaderJoão Barbosa
2019-01-04Merge #12151: rpc: Remove cs_main lock from blockToJSON and blockheaderToJSONMarcoFalke
b9f226b41f rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSON (João Barbosa) 343b98cbcd rpc: Specify chain tip instead of chain in GetDifficulty (João Barbosa) 54dc13b6a2 rpc: Fix SoftForkMajorityDesc and SoftForkDesc signatures (João Barbosa) Pull request description: Motivated by https://github.com/bitcoin/bitcoin/pull/11913#discussion_r157798157, this pull makes `blockToJSON` and `blockheaderToJSON` free of `cs_main` locks. Locking `cs_main` was required to access `chainActive` in order to check if the block was in the chain and to retrieve the next block index. With the this approach, `CBlockIndex::GetAncestor()` is used in a way to check if the block belongs to the specified chain tip and, at the same time, get the next block index. Tree-SHA512: a6720ace0182c19033bbed1a404f729d793574db8ab16e0966ffe412145611e32c30aaab02975d225df6d439d7b9ef2070e732b16137a902b0293c8cddfeb85f
2019-01-01[rpc] Correct reconsiderblock help text, add testMarcoFalke
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-07Merge #14863: refactor: Add and use HaveTxsDownloaded() where appropriateWladimir J. van der Laan
fa4fc8856b239059421a8e507b3e3e7f4b379a72 validation: Add and use HaveTxsDownloaded where appropriate (MarcoFalke) Pull request description: `nChainTx` is an implementation detail that shouldn't be exposed without a wrapper that comes with appropriate documentation. Tree-SHA512: 56ab7378c2ce97794498724c271f861de982de69099e90ec09632a26230ae6fded3c59668adb378bd64dcb8ef714769b970210977b88a53fc7550774ddba3d59
2018-12-05Merge #14796: rpc: Pass argument descriptions to RPCHelpManMarcoFalke
fabca42c68 RPCHelpMan: Add space after colons in extended description (MarcoFalke) fafd040f73 rpc: Add description to fundrawtransaction vout_index (MarcoFalke) 1db0096f61 rpc: Pass argument descriptions to RPCHelpMan (MarcoFalke) Pull request description: This will normalize the type names and formatting for the rpc arguments Tree-SHA512: 6ab344882f0fed36046ab4636cb2fa5d2479c6aae22666ca9a0d067edbb9eff8de98010ad97c8ce40ab532d15d1ae67120a561b0bf3da837090d7de427679f4f
2018-12-04validation: Add and use HaveTxsDownloaded where appropriateMarcoFalke
2018-11-27Merge #14477: Add ability to convert solvability info to descriptorPieter Wuille
109699dd33 Add release notes (Pieter Wuille) b65326b562 Add matching descriptors to scantxoutset output + tests (Pieter Wuille) 16203d5df7 Add descriptors to listunspent and getaddressinfo + tests (Pieter Wuille) 9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable (Pieter Wuille) 225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others (Pieter Wuille) 4d78bd93b5 Add support for inferring descriptors from scripts (Pieter Wuille) Pull request description: This PR adds functionality to convert a script to a descriptor, given a `SigningProvider` with the relevant information about public keys and redeemscripts/witnessscripts. The feature is exposed in `listunspent`, `getaddressinfo`, and `scantxoutset` whenever these calls are applied to solvable outputs/addresses. This is not very useful on its own, though when we add RPCs to import descriptors, or sign PSBTs using descriptors, these strings become a compact and standalone way of conveying everything necessary to sign an output (excluding private keys). Unit tests and rudimentary RPC tests are included (more relevant tests can be added once RPCs support descriptors). Fixes #14503. Tree-SHA512: cb36b84a3e0200375b7e06a98c7e750cfaf95cf5de132cad59f7ec3cbd201f739427de0dc108f515be7aca203652089fbf5f24ed283d4553bddf23a3224ab31f
2018-11-27rpc: Pass argument descriptions to RPCHelpManMarcoFalke
2018-11-23Merge #14726: Use RPCHelpMan for all RPCsWladimir J. van der Laan
fa5e0452e875a7ca6bf6fe61fdd652d341eece40 rpc: Documentation fixups (MarcoFalke) fa91e8eda541acdb78ca481b74605639f319c108 Use RPCHelpMan for all RPCs (MarcoFalke) fa520e72f7b5964cea1ade666e71212914556cf3 lint: Must use RPCHelpMan to generate the RPC docs (MarcoFalke) Pull request description: The resulting documentation should not change unless the type in the oneline-summary was previously incorrect. (E.g. string vs bool) Tree-SHA512: 4ff355b6a53178f02781e97a7aca7ee1d0d97ff348b6bf5a01caa1c96904ee33c704465fae54c2cd7445097427fd04c71ad3779bb7a7ed886055ef36c1b5a1d0
2018-11-19Merge #14718: Remove unreferenced boost headersMarcoFalke
c54e5a41c4 Remove unreferenced boost headers (Murray Nesbitt) Pull request description: Building with clang (e.g. on FreeBSD) is very noisy due to `-Wthread-safety-analysis` warnings regarding boost. This change removes a number of unnecessary boost includes, and silences the rest of the warnings when building with clang. This allows more potentially interesting warnings to surface from the noise. Tested on FreeBSD 11.2 Tree-SHA512: 5e6a0623188b9be59aeae52866799aefb4c3c9ab5e569b07ee8d43fc92e0b5f1f76b96bb54c35c7043148df84641b4a96927fb71f6eb00460c20cd19cf250900
2018-11-16Remove unreferenced boost headersMurray Nesbitt
2018-11-14Add matching descriptors to scantxoutset output + testsPieter Wuille
2018-11-14Use RPCHelpMan for all RPCsMarcoFalke
2018-11-13rpc: Correctly name argumentsJon Layton
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-04scripted-diff: Move util files to separate directory.Jim Posen
-BEGIN VERIFY SCRIPT- mkdir -p src/util git mv src/util.h src/util/system.h git mv src/util.cpp src/util/system.cpp git mv src/utilmemory.h src/util/memory.h git mv src/utilmoneystr.h src/util/moneystr.h git mv src/utilmoneystr.cpp src/util/moneystr.cpp git mv src/utilstrencodings.h src/util/strencodings.h git mv src/utilstrencodings.cpp src/util/strencodings.cpp git mv src/utiltime.h src/util/time.h git mv src/utiltime.cpp src/util/time.cpp sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj -END VERIFY SCRIPT-
2018-10-19rpc: Always throw in getblockstats if -txindex is requiredJoão Barbosa
Previously blocks with only the coinbase transaction didn't cause the RPC error even if the requested stats required -txindex and it wasn't enabled.
2018-10-09[rpc] Descriptions: Textual consistency fixesJon Layton
'Must be one of' should always end in a ':' 'hex encoded' is now always 'hex-encoded' Remove redundant '(defaults to CONSERVATIVE)' text from estimatesmartfee Consistent spacing for options '( verbose )' and '( verbosity )' 'BIP125 replaceable' is now always 'BIP125-replaceable' JSON-RPC example is now always 'As a JSON-RPC call'
2018-09-24Merge #13311: Don't edit Chainparams after initializationMarcoFalke
6fa901fb47 Don't edit Chainparams after initialization (Jorge Timón) 980b38f8a1 MOVEONLY: Move versionbits info out of versionbits.o (Jorge Timón) Pull request description: This encapsulates the "-vbparams" option, which is only meant for regtest, directly on CRegTestParams. This is a refactor and doesn't change functionality. Related to https://github.com/bitcoin/bitcoin/pull/8994 Tree-SHA512: 79771d729a63a720e743a9c77d5e2d80369f072d66202a43c1304e83a7d0ef7c6103d4968a03aea9666cc89a7203c618da972124a677b38cfe62ddaeb28f9f5d
2018-09-24Merge #13424: Consistently validate txid / blockhash length and encoding in ↵MarcoFalke
rpc calls 5eb20f81d9 Consistently use ParseHashV to validate hash inputs in rpc (Ben Woosley) Pull request description: ParseHashV validates the length and encoding of the string and throws an informative RPC error on failure, which is as good or better than these alternative calls. Note I switched ParseHashV to check string length first, because IsHex tests that the length is even, and an error like: "must be of length 64 (not 63, for X)" is much more informative than "must be hexadecimal string (not X)" in that case. Split from #13420 Tree-SHA512: f0786b41c0d7793ff76e4b2bb35547873070bbf7561d510029e8edb93f59176277efcd4d183b3185532ea69fc0bbbf3dbe9e19362e8017007ae9d51266cd78ae
2018-09-23MOVEONLY: Move versionbits info out of versionbits.oJorge Timón
2018-09-11Merge #13558: Drop unused GetType() from CSizeComputerWladimir J. van der Laan
893628be0166b4096b6e52f516e0f65bb63a75a2 Drop minor GetSerializeSize template (Ben Woosley) da74db0940720407fafaf3582bbaf9c81a4d3b4d Drop unused GetType() from CSizeComputer (Ben Woosley) Pull request description: Based on conversation in #13462, it seems the serialization `GetType` has very narrow use/effect. In every case except for `CAddress`, which specifically relates to a network peer's address, not a wallet address etc., the serialized representation of an object is irrespective of its destination / type. This removes the unused `GetType` method from `CSizeComputer` as a step to further narrowing that use. Tree-SHA512: e72b8e9e5160396691e05aeaee3aba5a57935a75bd5005cfcc7fb51c936f3d1728a397f999da5c36696506dd815fafa5c738f3894df8864f25f91f639eba9c3d
2018-09-11Drop unused GetType() from CSizeComputerBen Woosley
2018-09-10Merge #14008: Preserve a format of RPC command definitionsWladimir J. van der Laan
d9d79576f423cd9c5cef4547c7e3648dbb339460 Preserve a format of RPC command definitions (Kostiantyn Stepaniuk) Pull request description: Currently, RPC commands are formatted in a way that it's easy to read and that `test/lint/check-rpc-mappings.py` can parse it. To void breaking `test/lint/check-rpc-mappings.py` script by running `clang-format`, RPC command definitions should be disabled for clang-format. Tree-SHA512: e17d20ec0e6c4e19410198b55687ebbe6fa01654d214d4578cd16c00b872bf8b0b306594a45523685cd2e9d9280702e00471d9366e87954428e8bbeacd8cad60
2018-09-09rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSONJoão Barbosa
2018-09-09rpc: Specify chain tip instead of chain in GetDifficultyJoão Barbosa
2018-09-09rpc: Fix SoftForkMajorityDesc and SoftForkDesc signaturesJoão Barbosa
2018-09-05Adjust TODO linkPieter Wuille
2018-09-04Merge #13249: Make objects in range declarations immutable by default. Avoid ↵Wladimir J. van der Laan
unnecessary copying of objects in range declarations. f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift) Pull request description: Make objects in range declarations immutable by default. Rationale: * Immutable objects are easier to reason about. * Prevents accidental or hard-to-notice change of value. Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
2018-08-31scripted-diff: Small locking renameRussell Yanofsky
Call sync.h primitives "locks" and "mutexes" instead of "blocks" and "waitable critical sections" to match current coding conventions and c++11 standard names. This PR does not rename the "CCriticalSection" class (though this could be done as a followup) because it is used everywhere and would swamp the other changes in this PR. Plain mutexes should mostly be preferred instead of recursive mutexes in new code anyway. -BEGIN VERIFY SCRIPT- set -x set -e ren() { git grep -l $1 | xargs sed -i s/$1/$2/; } ren CCriticalBlock UniqueLock ren CWaitableCriticalSection Mutex ren CConditionVariable std::condition_variable ren cs_GenesisWait g_genesis_wait_mutex ren condvar_GenesisWait g_genesis_wait_cv perl -0777 -pi -e 's/.*typedef.*condition_variable.*\n\n?//g' src/sync.h -END VERIFY SCRIPT-
2018-08-31Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSectionWladimir J. van der Laan
9c4dc597ddc66acfd58a945a5ab11f833731abba Use LOCK macros for non-recursive locks (Russell Yanofsky) 1382913e61f5db6ba849b1e261e8aefcd5a1ae68 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection (Russell Yanofsky) ba1f095aadf29bddb0bd8176d2e0b908f92a5623 MOVEONLY Move AnnotatedMixin declaration (Russell Yanofsky) 41b88e93375d57db12da923f45f87b9a2db8e730 Add unit test for DEBUG_LOCKORDER code (Russell Yanofsky) Pull request description: Make LOCK macros work with non-recursive mutexes, and use wherever possible for better deadlock detection. Also add unit test for DEBUG_LOCKORDER code. Tree-SHA512: 64ef209307f28ecd0813a283f15c6406138c6ffe7f6cbbd084161044db60e2c099a7d0d2edcd1c5e7770a115e9b931b486e86c9a777bdc96d2e8a9f4dc192942
2018-08-27Make objects in range declarations immutable by default. Avoid unnecessary ↵practicalswift
copying of objects in range declarations.
2018-08-26Merge #12676: Show "bip125-replaceable" flag, when retrieving mempool entriesWladimir J. van der Laan
870bd4c73ddf494dc23c658bf0fb672ee0109158 Update functional RBF test to check replaceable flag (dexX7) 820d31f95fb6b886b38dab5d378825bea7edd49e Add "bip125-replaceable" flag to mempool RPCs (dexX7) Pull request description: This pull request adds a flag "bip125-replaceable" to the mempool RPCs getrawmempool, getmempoolentry, getmempoolancestors and getmempooldescendants, which indicates whether an unconfirmed transaction might be replaced. Initially the flag was added to the raw transaction RPCs, but thanks to @conscott, it was moved to the mempool RPCs, which actually have access to the mempool. ~~This pull request adds a flag "bip125-replaceable" to the RPCs "getrawtransaction" and "decoderawtransaction", which indicates, whether a transaction signals BIP 125 replaceability.~~ There was some discussion in #7817, whether showing replaceability in the UI could lead to the false assumption that transactions that don't signal BIP 125 are truely non-replaceable, but given that this PR tackles the raw transaction interface, which is a rather low level tool, I believe having this extra piece of information isn't bad. Tree-SHA512: 1f5511957af2c20a9a6c79d80a335c3be37a2402dbf829c40cceaa01a24868eab81a9c1cdb0b3d77198fa3bb82799e3540a5c0ce7f35bbac80d73f7133ff7cbc
2018-08-20Preserve a format of RPC command definitionsKostiantyn Stepaniuk
Currently RPC commands are formatted in a way that it's easy to read and that test/lint/check-rpc-mappings.py can parse it. To void breaking test/lint/check-rpc-mappings.py script by running clang-format, RPC command definitions should be disabled for clang-format.
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-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-07Consistently use ParseHashV to validate hash inputs in rpcBen Woosley
ParseHashV validates the length and encoding of the string and throws an informative RPC error on failure, which is as good or better than these alternative calls. Note I switched ParseHashV to check string length first, because IsHex tests that the length is even, and an error like: "must be of length 64 (not 63, for X)" is much more informative than "must be hexadecimal string (not X)"
2018-08-03Use LOCK macros for non-recursive locksRussell Yanofsky
Instead of std::unique_lock.
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-27Update copyright headers to 2018DrahtBot
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-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