aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
AgeCommit message (Collapse)Author
2020-07-15Increment input value sum only once per UTXO in decodepsbtAndrew Chow
Github-Pull: #19517 Rebased-From: 75122780e2c46505d977e24c5612dfa9442ab754
2020-07-08Clean up separated ban/discourage interfacePieter Wuille
Github-Pull: #19219 Rebased-From: 2ad58381fffb33d611abf900b73d9e6b5a4e35f8
2020-07-08Replace automatic bans with discouragement filterPieter Wuille
This patch improves performance and resource usage around IP addresses that are banned for misbehavior. They're already not actually banned, as connections from them are still allowed, but they are preferred for eviction if the inbound connection slots are full. Stop treating these like manually banned IP ranges, and instead just keep them in a rolling Bloom filter of misbehaving nodes, which isn't persisted to disk or exposed through the ban framework. The effect remains the same: preferred for eviction, avoided for outgoing connections, and not relayed to other peers. Also change the name of this mechanism to better reflect reality; they're not banned, just discouraged. Contains release notes and several interface improvements by John Newbery. Github-Pull: #19219 Rebased-From: b691f2df5f7d443c0c9ee056ab94aa0fc19566d5
2020-07-03rpc: show both UTXOs in decodepsbtAndrew Chow
Github-Pull: #19215 Rebased-From: 72f6bec1da198764d4648a10a61c485e7ab65e9e
2020-06-02Merge #19019: [0.20] Fix GBT: Restore "!segwit" and "csv" to "rules" keyMarcoFalke
412d5fe8791c417bf46fc55a5bb8d59be98a33db QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr) 2abe8cc3b760219cfa434e4c96e9f8d3611d0037 Bugfix: Include "csv","!segwit" in "rules" (Luke Dashjr) Pull request description: Original branch merges cleanly (no rebase needed) See also #17946 ACKs for top commit: jnewbery: utACK 412d5fe8791c417bf46fc55a5bb8d59be98a33db Tree-SHA512: 8b269f7782c10f02dc245cc377d91f594474eade6a32184a49fa2ed3928d91917e4b83eefee6947bfb5ffff54eca2781f8cf2169c1f0ad3fefca1d4b3cf304dd
2020-05-15miner: Avoid stack-use-after-return in validationinterfaceMarcoFalke
This is achieved by switching to a shared_ptr. Also, switch the validationinterfaces in the tests to use shared_ptrs for the same reason. Github-Pull: #18742 Rebased-From: 7777f2a4bb1f9d843bc50a4e35085cfbb2808780
2020-05-15rpc: Add mutex to guard deadlineTimersJoão Barbosa
Github-Pull: #18814 Rebased-From: a2e6db5c4f1bb52a8814102b628e51652493d06a
2020-05-05rpc: Do not advertise dumptxoutset as a way to flush the chainstateMarcoFalke
Github-Pull: #18809 Rebased-From: fac0cf6e5513df1402068df113d496b4e03a4bdc
2020-04-10Merge #18541: rpc: Make verifychain default values static, not depend on ↵MarcoFalke
global args fad691cafe083743a26f434488990f060ae4ac45 rpc: Make verifychain default values static, not depend on global args (MarcoFalke) Pull request description: This fixes several issues: * The documentation is not compile-time static and depends on run-time arguments, making it impossible to host it on a static resource like a website or pdf. See also a similar change in the wallet rpc code: #18499 * The same call (relying on default values) will run different code on different machines, depending on the command line args that were used to start the server. This might lead to hard-to-debug-remote issues. This is a small behaviour change, and I will add release notes. ACKs for top commit: theStack: ACK https://github.com/bitcoin/bitcoin/pull/18541/commits/fad691cafe083743a26f434488990f060ae4ac45 promag: Code review ACK fad691cafe083743a26f434488990f060ae4ac45. Tree-SHA512: 1c7a253ff0ec13a973b10d3777b71c70954ded5805b65a3ab06317327014de4cd0601d71d30c6ce89a581722c150cb5567acc1bd3e0c789cb51bab6ef0dcfc4a
2020-04-07Merge #18532: rpc: Avoid initialization-order-fiasco on static CRPCCommand ↵MarcoFalke
tables fa1a92224dd78de817d15bcda35a8310254e1a54 rpc: Avoid initialization-order-fiasco on static CRPCCommand tables (MarcoFalke) Pull request description: Currently the fiasco is only theoretical because all content of the table are compile-time constants. However, the fiasco materializes should they ever become run-time constants (e.g. #18531). ACKs for top commit: promag: ACK fa1a92224dd78de817d15bcda35a8310254e1a54. practicalswift: ACK fa1a92224dd78de817d15bcda35a8310254e1a54 -- fiasco bad :) Tree-SHA512: cccadb0ad56194599b74f04264d74c34fa865958580a850efc6474bbdc56f30cadce6b2e9a6ad5472ff46c3f4c793366acd8090fad409a45b25d961f2d89da19
2020-04-07Merge #18484: rpc: Correctly compute redeemScript from witnessScript for ↵MarcoFalke
signrawtransaction cd3b1569d9ad8e24d3a222aff74e0c254baadf79 Correctly compute redeemScript from witnessScript for signrawtransaction (Andrew Chow) Pull request description: `ParsePrevouts` uses `GetScriptForWitness` on the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script a `WitnessV0ScriptHash` destination and get the script for that. Test cases are also added. These will fail on master with a `redeemScript does not correspond to witnessScript` Reported on [Bitcointalk](https://bitcointalk.org/index.php?topic=5236818.0) ACKs for top commit: MarcoFalke: weak ACK cd3b1569d9, only checked that the test fails without the code change 🚰 instagibbs: utACK https://github.com/bitcoin/bitcoin/pull/18484/commits/cd3b1569d9ad8e24d3a222aff74e0c254baadf79 Tree-SHA512: afac671dbb52ce88bfb4a9ca3dd6065427ad52c9778d0549ad40e9286778f308adad24fb3b3c3089545d7f88c57c53d41224fd7a4bb207550eff2fe06600118f
2020-04-07rpc: Make verifychain default values static, not depend on global argsMarcoFalke
2020-04-06rpc: Avoid initialization-order-fiasco on static CRPCCommand tablesMarcoFalke
2020-04-02Bugfix: RPC: JSON null is not "None"Luke Dashjr
2020-04-02Bugfix: RPC: Don't use a continuation elipsis after an elision elipsisLuke Dashjr
2020-04-02Bugfix: RPC: Add missing commas and correct indentation of explicit ELISIONLuke Dashjr
2020-03-31Correctly compute redeemScript from witnessScript for signrawtransactionAndrew Chow
ParsePrevouts uses GetScriptForWitness on the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script a WitnessV0ScriptHash destination and get the script for that. Test cases are also added.
2020-03-28Merge #18444: RPC: Remove final comma for last entry of fixed-size ↵MarcoFalke
arrays/objects in RPCResult c34164896c62fc6307b4cc72c060a277263590bb Bugfix: RPC: Remove final comma for last entry of fixed-size Arrays and Objects in RPCResult (Luke Dashjr) Pull request description: JSON doesn't allow a trailing comma in arrays Top commit has no ACKs. Tree-SHA512: 761502a05f447afc09c120f13bf23abd2aee83a7f5e5dadaf54c7e1c0c1280d83ee041ca6ca45998fb561e41b32d01067ec52a187c3bcc9d53303ea813bc212c
2020-03-28Merge #18449: util: Remove unused itostrWladimir J. van der Laan
faaf1cb5b9a4c22b21757f7578833f908b79b867 util: Replace i64tostr with ToString (MarcoFalke) fac96fff624a3ab65209dcd3378efb6e6ab47a58 util: Remove unused itostr (MarcoFalke) Pull request description: Currently unused, but if someone really needed to use a helper with this functionality in the future, they could use `ToString`. ACKs for top commit: laanwj: ACK faaf1cb5b9a4c22b21757f7578833f908b79b867 promag: Code review ACK faaf1cb5b9a4c22b21757f7578833f908b79b867. Tree-SHA512: 42180c03f51d677f7b69da23c7868bdd88944335fad0752fcc307f2c3e3c69f1cc1b316ac0875bcefb9a69c5d55200d7cf66843ea4c0f0f26baf7a054b96c1bb
2020-03-28Bugfix: RPC: Remove final comma for last entry of fixed-size Arrays and ↵Luke Dashjr
Objects in RPCResult JSON doesn't allow a trailing comma in Arrays/Objects
2020-03-27util: Replace i64tostr with ToStringMarcoFalke
2020-03-27Merge #18398: rpc: fix broken RPCExamples for waitforblock(height)fanquake
ef35604c9c88e7800e9be106b791b1c0fa8b310a rpc: fix broken RPCExamples for waitforblock(height) (Sebastian Falbesoner) Pull request description: This PR fixes several broken RPCExamples from the "blockchain" category: - `HelpExampleCli` for `waitforblock` (disturbing comma between arguments) - `HelpExampleCli` for `waitforblockheight` (disturbing comma between arguments) - `HelpExampleRpc` for `waitforblockheight` (disturbing quotation marks around integer argument) Note that the CLI example for `waitforblockheight` would also work with the first argument in quotation marks (in contrast to the RPC example), but I removed them as well as they are not needed. Outputs for the non-working examples in the master branch: ``` $ ./bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862", 1000 error code: -8 error message: blockhash must be of length 64 (not 65, for '0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862,') ``` ``` $ ./bitcoin-cli waitforblockheight "100", 1000 error: Error parsing JSON:100, ``` ``` $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "waitforblockheight", "params": ["100", 1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ Enter host password for user '__cookie__': {"result":null,"error":{"code":-1,"message":"JSON value is not an integer as expected"},"id":"curltest"} ``` Outputs for the fixed examples in the PR branch: ``` $ ./bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862" 1000 { "hash": "0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080", "height": 622416 } ``` ``` $ ./bitcoin-cli waitforblockheight 100 1000 { "hash": "0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080", "height": 622416 } ``` ``` $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "waitforblockheight", "params": [100, 1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ Enter host password for user '__cookie__': {"result":{"hash":"0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080","height":622416},"error":null,"id":"curltest"} ``` ACKs for top commit: fanquake: ACK ef35604c9c88e7800e9be106b791b1c0fa8b310a Tree-SHA512: b98c6681d1aa24b3ee3ef4ef450cb630082a9f8695af18f3b6d418e5b0b1e472b787ccf6397cd719b4d5fe0082ea5f1d0ca553c1cc56066ee2d288be34c601e3
2020-03-25Merge #18134: Replace std::to_string with locale-independent alternativeWladimir J. van der Laan
d056df033a1e88554f7cc39dd709a87b17cb49df Replace std::to_string with locale-independent alternative (Ben Woosley) Pull request description: Addresses #17866 following practicalswift's suggestion: https://github.com/bitcoin/bitcoin/issues/17866#issuecomment-584287299 ~Used ::ToString to avoid aliasing issues. Left uses in QT and test.~ ACKs for top commit: practicalswift: ACK d056df033a1e88554f7cc39dd709a87b17cb49df laanwj: ACK d056df033a1e88554f7cc39dd709a87b17cb49df Tree-SHA512: 9e6966a9cdd14f4a1a40d9f0fa7c402aed22b2f1ad8681708e22b050d51a91c5d62220a9ec4c425be2d57acf5c964fca87a5e981b5cbff048bc3b6720dae92b7
2020-03-21rpc: fix broken RPCExamples for waitforblock(height)Sebastian Falbesoner
Fixes the following RPCExamples: -> ExampleCli waitforblock (removed comma between arguments) -> ExampleCli waitforblockheight (removed comma between arguments) -> ExampleRpc waitforblockheight (removed quotation marks around integer argument)
2020-03-21rpc: add missing HelpExampleRpc for getblockfilterSebastian Falbesoner
2020-03-16Merge #18346: rpc: Document an RPCResult for all calls; Enforce at compile timeWladimir J. van der Laan
fac52253f81a4f0d04b25eb4b6c28d04b85ef10b rpc: Document an RPCResult for all calls; Enforce at compile time (MarcoFalke) fadd99f61032c0b75ad9b198eb5d8e307b0518ee rpc: Add missing newline in RPCResult description (MarcoFalke) Pull request description: This documents the RPC Result (type and description, if applicable) everywhere it was missing. The patch can be reviewed with the `git diff` option `-W`/`--function-context`. Also, code won't compile without having an RPCResult documented. ACKs for top commit: laanwj: Lightly tested ACK fac52253f81a4f0d04b25eb4b6c28d04b85ef10b promag: Tested ACK fac52253f81a4f0d04b25eb4b6c28d04b85ef10b, built and verified listunspent help output. Tree-SHA512: af2c1af1432beb944993776026c320814bfaecaf202f47359f5758849096ca7051ec6560395a2cc6678dcc111e7c9cf4917d0f0b221bdcf3ed1642e14d0e5b3c
2020-03-14Replace std::to_string with locale-independent alternativeBen Woosley
2020-03-13rpc: Document an RPCResult for all calls; Enforce at compile timeMarcoFalke
2020-03-13Fix nit in getblockchaininfoSteven Roose
2020-03-13Merge #18316: util: HelpExampleRpc formattingfanquake
a33cffbeabcc42137c4a66aa19b7dd1d300e6d73 util: HelpExampleRpc formatting fixup (Jon Atack) Pull request description: Minor visual fixup of the HelpExampleRpc template; conforms to the JSON-RPC spec as per https://www.jsonrpc.org/specification#examples. (I'm... somewhat embarassed to open such a minor change, but this is what is shown in all the CLI/RPC help docs.) ACKs for top commit: laanwj: ACK a33cffbeabcc42137c4a66aa19b7dd1d300e6d73 Tree-SHA512: 8f1dee080c224742fff60a33fec6f5fb1d59c9fa51f3f2a67bf2e1837dbfa25f12a69e34518936588940013b0e61f55378b4f1a571c47c3cb081ca5b245e1091
2020-03-11Merge #18268: rpc: Remove redundant types from descriptionsMarcoFalke
8a2a652e6fab5eb8224beefcc07d9011b61865a8 Remove redundant type information from rpc docs (David O'Callaghan) Pull request description: Simple edit of the RPC calls to remove redundant text ("A json object/array ...") from the beginning of help. Fixes: #18258 Top commit has no ACKs. Tree-SHA512: cbbf760e0b7b4eda61c40b420ed77f5d878318e37b0eb13e63567212240b2c4ecc15d84030e98075e21c9ae9016539adfd201e5661ea824166a76d335180c32f
2020-03-11Merge #18208: rpc: Change RPCExamples to bech32MarcoFalke
3e32499909ca8127baaa9b40ad113b25ee151bbd Change example addresses to bech32 (Yusuf Sahin HAMZA) Pull request description: This is a follow-up PR to #18197 that fixes RPCExamples. Fixes #18185. ACKs for top commit: MarcoFalke: ACK 3e32499909ca8127baaa9b40ad113b25ee151bbd jonatack: ACK 3e32499 Tree-SHA512: c7a6410ef8b6e169016c2c5eac3e6b9501caabd0e8a0871ec31e56bfc44589f056d3f5cb55b5a13bba36f6c15136c2352f883e30e4dcc0997ffd36b27f9173b9
2020-03-11util: HelpExampleRpc formatting fixupJon Atack
to conform to json-rpc spec as per https://www.jsonrpc.org/specification#examples
2020-03-08Refactor rawtransaction's SignTransaction into generic SignTransaction functionAndrew Chow
2020-03-06scheduler: switch from boost to stdAnthony Towns
Changes from boost::chrono to std::chrono, boost::condition_var to std::condition_var, boost::mutex to sync.h Mutex, and reverselock.h to sync.h REVERSE_LOCK. Also adds threadsafety annotations to CScheduler members.
2020-03-06Merge #16117: util: Replace boost sleep with std sleepfanquake
fae86c38bca5c960462e53975314a0749db5d17d util: Remove unused MilliSleep (MarcoFalke) fa9af06d91e9357e86863781746f0e78a509967e scripted-diff: Replace MilliSleep with UninterruptibleSleep (MarcoFalke) fa4620be782c2bf6b5ffddf4f671194fdd1536f3 util: Add UnintrruptibleSleep (MarcoFalke) Pull request description: We don't use the interruptible feature of boost's sleep anywhere, so replace it with the sleep in `std::thread` ACKs for top commit: ajtowns: ACK fae86c38bca5c960462e53975314a0749db5d17d quick code review practicalswift: ACK fae86c38bca5c960462e53975314a0749db5d17d -- patch looks correct sipa: Concept and code review ACK fae86c38bca5c960462e53975314a0749db5d17d fanquake: ACK fae86c38bca5c960462e53975314a0749db5d17d - note that an instance of `DHAVE_WORKING_BOOST_SLEEP_FOR` was missed in the [linter](https://github.com/bitcoin/bitcoin/blob/master/test/lint/extended-lint-cppcheck.sh#L69), but that can be cleaned up later. Tree-SHA512: 7c0f8eb197664b9f7d9fe6c472c77d384f11c797c913afc31de4b532e3b4fd9ea6dd174f92062ff9d1ec39b25e0900ca7c597435add87f0f2477d9557204848c
2020-03-05Merge #18260: refactor: Fix implicit value conversion in formatPingTimeMarcoFalke
1891245e7318bf625bbf67aab08a79fc3e87b61d refactor: Cast ping values to double before output (Ben Woosley) 7a810b1d7a9d03818706dc94457dc3255f062796 refactor: Convert ping wait time from double to int64_t (Ben Woosley) e6fc63ec7ee637a4b533e4d7b22def05e74e1dff refactor: Convert min ping time from double to int64_t (Ben Woosley) b054c46977667953593819248c167545aa3e7a40 refactor: Convert ping time from double to int64_t (Ben Woosley) Pull request description: Alternative to #18252, see motivation there. This changes `CNodeStats` to handle ping timestamps as their original incoming usec `int64_t` values until the time they need to be displayed. ACKs for top commit: vasild: ACK 1891245 practicalswift: ACK 1891245e7318bf625bbf67aab08a79fc3e87b61d -- patch looks correct promag: ACK 1891245e7318bf625bbf67aab08a79fc3e87b61d, added cast to double and also braces. Tree-SHA512: 7cfcba941d9751b522b8c512c25da493338b444637bd0bb711b152d7d86b431ca0968956be3c844ee9dbfea25edab44a0de2afa44f2c9c0bf5b8df53eba66272
2020-03-05Merge #18263: rpc: change setmocktime check to use IsMockableChainMarcoFalke
2455aa5d7f54befeade05795ed8f5dd89d01042a [rpc] changed MineBlocksOnDemand to IsMockableChain (Gloria Zhao) Pull request description: Change: Update the if statement in `setmocktime` to use `IsMockableChain` chainparams function (aka `m_is_mockable_chain`) instead of `MineBlocksOnDemand` Rationale: It's a more appropriate check for whether or not chain is in RegTest, as [discussed](https://github.com/bitcoin/bitcoin/pull/18037#discussion_r376509388) in #18037 ACKs for top commit: MarcoFalke: ACK 2455aa5d7f54befeade05795ed8f5dd89d01042a 🙇 jonatack: ACK 2455aa5d7f54befeade05795ed8f5dd89d01042a Tree-SHA512: 1d8c8b7ff0b3c1bcbf5755194969b6664fe05a35003375ad08d18e34bcefd2df4f64d0e60078a10bbef3c8f469a9b9d07db467089b55c14cf532304bc965bffc
2020-03-05[rpc] changed MineBlocksOnDemand to IsMockableChainGloria Zhao
2020-03-05Remove redundant type information from rpc docsDavid O'Callaghan
Co-Authored-By: MarcoFalke <falke.marco@gmail.com>
2020-03-05refactor: Cast ping values to double before outputBen Woosley
Note the divisor is a floating point literal so presumably also floating point.
2020-03-04refactor: Convert ping wait time from double to int64_tBen Woosley
2020-03-04refactor: Convert min ping time from double to int64_tBen Woosley
2020-03-04refactor: Convert ping time from double to int64_tBen Woosley
2020-03-04rpc: fix getpeerinfo RPCResult `mapped_as` typeJon Atack
and mention it is only available if the asmap config flag is set.
2020-03-04Merge #17809: rpc: Auto-format RPCResultMarcoFalke
fa6b061fc118995eec41766519a11bc0dd1a901d rpc: Auto-format RPCResult (MarcoFalke) fa7d0503d320900e14c4d9bc016d65c7431070bb rpc: Move OuterType enum to header (MarcoFalke) Pull request description: This enforces most syntax rules of the RPCResult at compile time (or some at run time during unit and functional tests) Apart from normalizing the syntax, by separating stylistic formatting from the structure, we could in theory directly generate the html for e.g. https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/importmulti/ ACKs for top commit: Sjors: Indeed, re-ACK fa6b061fc118995eec41766519a11bc0dd1a901d ajtowns: ACK fa6b061fc118995eec41766519a11bc0dd1a901d -- skimmed code changes and differences to rpc help output Tree-SHA512: 5b510b3aa0b7c7b9189a48c77593159409069f939145b9a00c5478e894cf65f994d44d633eb7bb7dbea40ee820645a2930976c24772379d96929002b120efa28
2020-03-01Change example addresses to bech32Yusuf Sahin HAMZA
2020-02-27Refactor FormatStateMessage into ValidationStateJeffrey Czyz
2020-02-25rpc: Auto-format RPCResultMarcoFalke
2020-02-25rpc: Move OuterType enum to headerMarcoFalke
This is needed so that it can be used by RPCResult Also, * rename NAMED_ARG to NONE for generalization. * change RPCArg constructors to initialize the members by moving values