aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
AgeCommit message (Collapse)Author
2018-06-15Merge #13241: scripted-diff: Avoid temporary copies when looping over std::mapMarcoFalke
9b72c988a0 scripted-diff: Avoid temporary copies when looping over std::map (Ben Woosley) Pull request description: The ::value_type of the std::map/std::multimap/std::unordered_map containers is std::pair<const Key, T>. Dropping the const results in an unnecessary copy, for example in C++11 range-based loops. For this I started with a more general scripted diff, then narrowed it down based on the inspection showing that all actual map/multimap/unordered_map variables used in loops start with m or have map in the name. Tree-SHA512: b656d66b69ffa1eb954124aa8ae2bc5436ca50262abefa93bdda55cfcdaffc5ff90cd40539051a2bd06355ba69ddf245265cc8764eebff66d761b3aec06155a9
2018-06-13expose CBlockIndex::nTx in getblock(header)Gregory Sanders
2018-06-11scripted-diff: Avoid temporary copies when looping over std::mapBen Woosley
The ::value_type of the std::map/std::multimap/std::unordered_map containers is std::pair<const Key, T>. Dropping the const results in an unnecessary copy, for example in C++11 range-based loops. For this I started with a more general scripted diff, then narrowed it down based on the inspection showing that all actual map/multimap/unordered_map variables used in loops start with m or have map in the name. -BEGIN VERIFY SCRIPT- sed -i -E 's/for \(([^<]*)std::pair<([^c])(.+) : m/for (\1std::pair<const \2\3 : m/' src/*.cpp src/**/*.cpp sed -i -E 's/for \(([^<]*)std::pair<([^c])(.+) : (.*)map/for (\1std::pair<const \2\3 : \4map/' src/*.cpp src/**/*.cpp -END VERIFY SCRIPT-
2018-06-11Merge #13060: [wallet] [rpc] Remove getlabeladdress RPCWladimir J. van der Laan
67e0e04140b3dfac12d628cee391d40b5fac5cfa [wallet] [docs] Update release notes for removing `getlabeladdress` (John Newbery) 81608178cff793ee205a4f70481c76d34c5448a4 [wallet] [rpc] Remove getlabeladdress RPC (John Newbery) Pull request description: labels are associated with addresses (rather than addresses being associated with labels, as was the case with accounts). The getlabeladdress does not make sense in this model, so remove it. getaccountaddress is still supported for one release as the accounts API is deprecated. Tree-SHA512: 7f45d0456248ebcc4e54dd34e2578a09a8ea8e4fceda75238ccea9d731dc99a3f3c0519b18a9739de17d2e6e59c9c2259ba67c9ae2e3cb2a40ddb14b9193fe29
2018-06-08Merge #13259: refactoring: add a method for determining if a block is pruned ↵Wladimir J. van der Laan
or not e9a1881b90704c6708cfba79d2208debbd4476d0 refactor: add a function for determining if a block is pruned or not (Karl-Johan Alm) Pull request description: The check for whether a block is pruned or not is sufficiently obscure that it deserves a macro. It is also used in 2 places, ~~with more coming, e.g. #10757~~ (turns out it was a move, not an addition). Tree-SHA512: b9aeb60663e1d1196df5371d5aa00b32ff5d4cdea6a77e4b566f28115cce09570c18e45e4b81a4033f67c4135c8e32c027f67bae3b75c2ea4564285578a3f4dd
2018-06-05Merge #13288: rpc: Remove the need to include rpc/blockchain.cpp in order to ↵Wladimir J. van der Laan
put `GetDifficulty` under test ebec7317ca1acbc65afa7fb08fc219c315fc4527 Drop the chain argument to GetDifficulty (Ben Woosley) Pull request description: By dropping the chain argument to `GetDifficulty`. `GetDifficulty` was called in two ways: * with a guaranteed non-null blockindex * with no argument Change the latter case to be provided `chainActive.Tip()` explicitly. Introduced in: #11748 Tree-SHA512: f2c97014be185f3e3de92db15848548650e4a67fab20a41bcfa851c5c63c245915cbe9380f84d9da2081e8756d31a41de417db1d35cfecf41ddb4f25070eb525
2018-06-05Merge #13269: refactoring: Drop UpdateTransaction in favor of UpdateInputWladimir J. van der Laan
6aa33feadbe11bfa505a80a691d84db966aca134 Drop UpdateTransaction in favor of UpdateInput (Ben Woosley) Pull request description: Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the call (and, often, the enclosing loop). In most cases, this input is already immediately available and need not be looked up. Tree-SHA512: 8c7914a8b7ae975d8ad0e9d760e3c5da65776a5f79d060b8ffb6b3ff7a32235f71ad705f2185b368d9263742d7796bb562395d22b806d90e8502d8c496011e57
2018-05-30refactor: add a function for determining if a block is pruned or notKarl-Johan Alm
2018-05-24Merge #13063: Use shared pointer to retain wallet instanceWladimir J. van der Laan
80b4910f7d87983f50047074c3c2397b0a5c4e92 wallet: Use shared pointer to retain wallet instance (João Barbosa) Pull request description: Currently there are 3 places where it makes sense to retain a wallet shared pointer: - `vpwallets`; - `interfaces::Wallet` interface instance - used by the UI; - wallet RPC functions - given by `GetWalletForJSONRPCRequest`. The way it is now it is possible to have, for instance, listunspent RPC and in parallel unload the wallet (once #13111 is merged) without blocking. Once the RPC finishes, the shared pointer will release the wallet. It is also possible to get all existing wallets without blocking because the caller keeps a local list of shared pointers. This is mostly relevant for wallet unloading. This PR replaces #11402. Tree-SHA512: b7e37c7e1ab56626085afe2d40b1628e8d4f0dbda08df01b7e618ecd2d894ce9b83d4219443f444ba889096286eff002f163cb0a48f37063b62e9ba4ccfa6cce
2018-05-23Merge #10757: RPC: Introduce getblockstats to plot thingsWladimir J. van der Laan
41d0476f62269027ec2193a5f80d508d789de8aa Tests: Add data file (Anthony Towns) 4cbfb6aad9ba8fa17b5e7ed3e9a36dc8a24f1fcf Tests: Test new getblockstats RPC (Jorge Timón) 35e77a0288bcac5594ff25c10c9679a161cb730b RPC: Introduce getblockstats (Jorge Timón) cda8e36f019dd181e5c3774961b4f1335e5602cb Refactor: RPC: Separate GetBlockChecked() from getblock() (Jorge Timón) Pull request description: It returns per block statistics about several things. It should be easy to add more if people think of other things to add or remove some if I went too far (but once written, why not keep it? EDIT: answer: not to test or maintain them). The currently available options are: minfee,maxfee,totalfee,minfeerate,maxfeerate,avgfee,avgfeerate,txs,ins,outs (EDIT: see updated list in the rpc call documentation) For the x axis, one can use height or block.nTime (I guess I could add mediantime if there's interest [EDIT: nobody showed interest but I implemented mediantime nonetheless, in fact there's no distinction between x or y axis anymore, that's for the caller to judge]). To calculate fees, -txindex is required. Tree-SHA512: 2b2787a3c7dc4a11df1fce62c8a4c748f5347d7f7104205d5f0962ffec1e0370c825b49fd4d58ce8ce86bf39d8453f698bcd46206eea505f077541ca7d59b18c
2018-05-22RPC: Introduce getblockstatsJorge Timón
2018-05-22wallet: Use shared pointer to retain wallet instanceJoão Barbosa
2018-05-20Drop the chain argument to GetDifficultyBen Woosley
This removes the need to include rpc/blockchain.cpp in order to put GetDifficulty under test. GetDifficulty was called in two ways: * with a guaranteed non-null blockindex * with no argument Change the latter case to be provided chainActive.Tip() explicitly.
2018-05-18Drop UpdateTransaction in favor of UpdateInputBen Woosley
Updating the input explicitly requires the caller to present a mutable input, which more clearly communicates the effects and intent of the method. In most cases, this input is already immediately available and need not be looked up.
2018-05-16[wallet] [rpc] Remove getlabeladdress RPCJohn Newbery
labels are associated with addresses (rather than addresses being associated with labels, as was the case with accounts). The getlabeladdress does not make sense in this model, so remove it. getaccountaddress is still supported for one release as the accounts API is deprecated.
2018-05-14Merge #12963: Fix Clang Static Analyzer warningsMarcoFalke
159c32d1f1 Add assertion to guide static analyzers. Clang Static Analyzer needs this guidance. (practicalswift) fd447a6efe Fix dead stores. Values were stored but never read. Limit scope. (practicalswift) Pull request description: Fix Clang Static Analyzer warnings reported by @kallewoof in #12961: * Fix dead stores. Values were stored but never read. * Add assertion to guide static analyzers. See #12961 for details. Tree-SHA512: 83dbec821f45217637316bee978e7543f2d2caeb7f7b0b3aec107fede0fff8baa756da8f6b761ae0d38537740839ac9752f6689109c38a4b05c0c041aaa3a1fb
2018-05-14Merge #13116: Add Clang thread safety annotations for variables guarded by ↵MarcoFalke
cs_{rpcWarmup,nTimeOffset,warnings} 8499f15e67 Add Clang thread safety annotations for variables guarded by cs_warnings (practicalswift) cf13ad23d4 Add Clang thread safety annotations for variables guarded by cs_nTimeOffset (practicalswift) 012dec0347 Add Clang thread safety annotations for variables guarded by cs_rpcWarmup (practicalswift) Pull request description: Add Clang thread safety annotations for variables guarded by `cs_{rpcWarmup,nTimeOffset,warnings}`. Tree-SHA512: 8e0a4b9e36a4450bd75ad32c21d813bb572aaaa5b4a4cbdcbf4678e58ade6265c0b275352391168930a63fcbd09caa3b76e74595a7b14646054c52870c46d007
2018-05-14Merge #12560: [wallet] Upgrade path for non-HD wallets to HDWladimir J. van der Laan
a8da482 Bump wallet version for pre split keypool (Andrew Chow) dfcd9f3 Use a keypool of presplit keys after upgrading to hd chain split (Andrew Chow) 5c50e93 Allow -upgradewallet to upgradewallets to HD (Andrew Chow) 2bcf2b5 Test sethdseed (Andrew Chow) b5ba01a Add 'sethdseed' RPC to initialize or replace HD seed (Chris Moore) dd3c07a Separate HaveKey function that checks whether a key is in a keystore (Andrew Chow) Pull request description: Revival/rebase of #11085 Adds a new command `sethdseed` which allows you to either set or generate a new HD seed to be used. A new keypool can be generated or the original one kept and new keys added to the keypool will come from the new HD seed. Wallets that are not HD will be upgraded to be version FEATURE_HD_SPLIT when the `sethdseed` RPC command is used. I have also add some tests for this. Additionally `-upgradewallet` can now be used to upgrade a wallet from non-HD to HD. When it is used for such an upgrade, the keypool will be regenerated. Tree-SHA512: e56c792e150590429ac4a1061e8d6f7b20cca06366e184eb9bbade4cd6ae82699a28fe84f87031eadba97ad2c1606517a105f00fb7b45779c979243020071adb
2018-05-12Add 'sethdseed' RPC to initialize or replace HD seedChris Moore
2018-05-07RPC Docs: gettxout*: clarify bestblock and unspent countsDavid A. Harding
2018-05-07Refactor: RPC: Separate GetBlockChecked() from getblock()Jorge Timón
This does not change functionality
2018-05-05Add compile time checking for all ::mempool.cs runtime locking assertionspracticalswift
2018-05-03Make it clear which functions that are intended to be translation unit localpracticalswift
Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.
2018-05-02Add missing newlines to LogPrint debug loggingWladimir J. van der Laan
The linter only checked `LogPrintf`, not `LogPrint`. Fix the remaining cases.
2018-04-30Merge #12954: util: Refactor logging code into a global objectPieter Wuille
8c2d695c4a util: Store debug log file path in BCLog::Logger member. (Jim Posen) 8e7b961388 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen) 1eac317f25 util: Refactor GetLogCategory. (Jim Posen) 3316a9ebb6 util: Encapsulate logCategories within BCLog::Logger. (Jim Posen) 6a6d764ca5 util: Move debug file management functions into Logger. (Jim Posen) f55f4fcf05 util: Establish global logger object. (Jim Posen) Pull request description: This is purely a refactor with no behavior changes. This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state. Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
2018-04-30nit: fix typo for entry description stringmryandao
2018-04-29util: Refactor GetLogCategory.Jim Posen
Changing parameter types from pointers to references and uint32_t to BCLog::LogFlags simplies calling code.
2018-04-29Add Clang thread safety annotations for variables guarded by cs_rpcWarmuppracticalswift
2018-04-27util: Encapsulate logCategories within BCLog::Logger.Jim Posen
2018-04-27rpc: Move RPC_FORBIDDEN_BY_SAFE_MODE code to reserved sectionWladimir J. van der Laan
Although this code is no longer ever sent back after removing safe mode, it would be unwise to remove it from the header. For one, it would be bad to accidentally re-use the number. Also some API documentation / bindings are directly generated from the .h file - this is why the "Aliases for backward compatibility" are there. We don't want to break code that relies on this error code existing, even if it's never generated. So keep it around but move it to a reserved section.
2018-04-26Remove Safe modeAndrew Chow
2018-04-26Merge #12321: p2wsh and p2sh-p2wsh address in decodescriptWladimir J. van der Laan
41ff967 list the types of scripts we should consider for a witness program (fivepiece) 4f933b3 p2wpkh, p2wsh and p2sh-nested scripts in decodescript (fivepiece) Pull request description: Attempts to address #12244 . `p2wsh` addresses are returned only for scripts that are neither `p2sh` nor any witness program. Tree-SHA512: eb47f094c1a4c2ad2bcf27a8032307e43cf787d50bf739281aeb4101d97316a2f307b05118bf138298c937fa34e15f91436443a9b313f809fad2c43e94cd1831
2018-04-26Merge #12240: [rpc] Introduced a new `fees` structure that aggregates all ↵Wladimir J. van der Laan
sub-field fee types denominated in BTC 7de1de7 Add new fee structure with all sub-fields denominated in BTC (mryandao) Pull request description: the denomination for `fee` is current in btc while the other such as `decendentFee` and `ancestorFee` are in satoshis. Tree-SHA512: e428f6dca1d339f89ab73e38ce5903f5465c46b159069d9bcc3f8b1140fe6657fa49a11abe0088e9f7ba9999f64af72a349a4735bf5eaa61b8e4a185b23543f3
2018-04-25[rpc] Public interfaces to GetTransaction block until synced.Jim Posen
Now that the transaction index is updated asynchronously, in order to preserve the current behavior of public interfaces, the code blocks until the transaction index is caught up with the current state of the blockchain.
2018-04-25[validation] Replace tx index code in validation code with TxIndex.Jim Posen
2018-04-23Merge #12448: Interrupt block generation on shutdown requestWladimir J. van der Laan
0851a75 rpc: Interrupt block generation on shutdown request (João Barbosa) Pull request description: With this simple change, after running `bitcoin-cli -regtest generate 100000`, it is possible to interrupt `bitcoind` cleanly without waiting for the generation to complete. Tree-SHA512: f0f7cdde242e595cfdaea31ae8bddbc25933621b63f639e813d272c2b00ce2ef52f0c14ae44954ba8c49f0fc846bcc3bfd5419e52b3347a68bb0341ce6b02d26
2018-04-18wallet: Add HasWalletsJoão Barbosa
2018-04-18wallet: Add AddWallet, RemoveWallet, GetWallet and GetWalletsJoão Barbosa
With these new functions all vpwallets usage are removed and vpwallets is now a static variable (no external linkage).
2018-04-18Add new fee structure with all sub-fields denominated in BTCmryandao
2018-04-13Expose a transaction's weight via RPCMatt Corallo
2018-04-12Merge #12743: Fix csBestBlock/cvBlockChange waiting in rpc/miningPieter Wuille
4a6c0e3dcf Modernize best block mutex/cv/hash variable naming (Pieter Wuille) 45dd135039 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille) Pull request description: This is an alternative to #11694. It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it. Also rename the involved variable to modern guidelines, as there are very few uses. Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
2018-04-12Merge #12803: Make BaseSignatureCreator a pure interfaceWladimir J. van der Laan
be67831 Make DummySignatureCreator a singleton (Pieter Wuille) 190b8d2 Make BaseSignatureCreator a pure interface (Pieter Wuille) Pull request description: * Removes the `m_provider` field from `BaseSignatureCreator`. Instead both a `SigningProvider` (which provides keys and scripts) and a `BaseSignatureCreator` (which implements the transaction-specific (or other) signing logic) are passed into and down in `ProduceSignature`, making the two concepts orthogonal. * Makes `BaseSignatureCreator` a pure interface without constructor, making it easier to implement new derivations of it (for example for message signing). * As `DummySignatureCreator` now becomes a stateless object, turn it into a singleton `DUMMY_SIGNATURE_CREATOR`. Tree-SHA512: 5f1f4512e4ea7d02a31df7b9ede55008efa716c5b74a2630ca1c2fc6599584d8bf5f5641487266127f4b3788033803539fbd22b03ef1219c83c10da2d3da3dcd
2018-04-12Add assertion to guide static analyzers. Clang Static Analyzer needs this ↵practicalswift
guidance.
2018-04-11rpc: Drop redundant testing of signrawtransaction prevtxs argsBen Woosley
These other types are already tested on line 736.
2018-04-10[wallet] [rpc] introduce 'label' API for walletWladimir J. van der Laan
Add label API to wallet RPC. This is one step towards #3816 ("Remove bolt-on account system") although it doesn't actually remove anything yet. These initially mirror the account functions, with the following differences: - These functions aren't DEPRECATED in the help - Help mentions 'label' instead of accounts. In the language used, labels are associated with addresses, instead of addresses associated with labels. (unlike with accounts.) - Labels have no balance - No balances in `listlabels` - `listlabels` has no minconf or watchonly argument - Like in the GUI, labels can be set on any address, not just receiving addreses - Unlike accounts, labels can be deleted. Being unable to delete them is a common annoyance (see #1231). Currently only by reassigning all addresses using `setlabel`, but an explicit call `deletelabel` which assigns all address to the default label may make sense. Thanks to Pierre Rochard for test fixes.
2018-04-10Make BaseSignatureCreator a pure interfacePieter Wuille
2018-04-09Merge #12007: [Doc] Clarify the meaning of fee delta not being a fee rate in ↵MarcoFalke
prioritisetransaction RPC c198dc00e1 [Doc] Clarify the meaning of fee delta not being a fee rate in prioritisetransaction RPC (Jan Čapek) Pull request description: Hi, I have faced some confusion among our developers considering this being a fee rate. Would you consider including this tiny doc update? Best regards, Jan Capek Tree-SHA512: cd0560540418e53c5c19ceab2d5aca229f4ef6b788b9543695742522e1c63a7f2cce2574b47fead098a106da2f77e297f0c728474565f6259b50d62369bbe7da
2018-04-08list the types of scripts we should consider for a witness programfivepiece
2018-04-07Merge #12860: Add testmempoolaccept to release-notes, Add missing constWladimir J. van der Laan
fafcad3 doc: Add testmempoolaccept to release-notes (MarcoFalke) Pull request description: Some fixups for #11742: * Add release notes for the new rpc * Fix a typo in the original pull * Make the mempool reference passed to `CheckInputsFromMempoolAndCache` const, since that function is called before we return from ATMP and we must not modify the mempool. Tree-SHA512: 72c459ba69f7698a69c91d2592f10f7fb1864846c7d8c525050d48286f92ba5ec5fe554c54235b52fbd9a8f00226c526ad84584641ec39084e1a1310a261510d
2018-04-05Merge #12859: Bugfix: Include <memory> for std::unique_ptrWladimir J. van der Laan
a5bca13 Bugfix: Include <memory> for std::unique_ptr (Luke Dashjr) Pull request description: Not sure why all these includes were missing, but it's breaking builds for some users: https://bugs.gentoo.org/show_bug.cgi?id=652142 (Added to all files with a reference to `std::unique_ptr`) Tree-SHA512: 8a2c67513ca07b9bb52c34e8a20b15e56f8af2530310d9ee9b0a69694dd05e02e7a3683f14101a2685d457672b56addec591a0bb83900a0eb8e2a43d43200509