0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-05 10:17:30 -05:00
bitcoin-bitcoin-core/src/rpc
MarcoFalke 25ad2c623a
Merge #18740: Remove g_rpc_node global
b3f7f375ef refactor: Remove g_rpc_node global (Russell Yanofsky)
ccb5059ee8 scripted-diff: Remove g_rpc_node references (Russell Yanofsky)
6fca33b2ed refactor: Pass NodeContext to RPC and REST methods through util::Ref (Russell Yanofsky)
691c817b34 Add util::Ref class as temporary alternative for c++17 std::any (Russell Yanofsky)

Pull request description:

  This PR removes the `g_rpc_node` global, to get same benefits we see removing other globals and make RPC code more testable, modular, and reusable.

  This uses a hybrid of the approaches suggested in #17548. Instead of using `std::any`, which isn't available in c++11, or `void*`, which isn't type safe, it uses a small new `util::Ref` helper class, which acts like a simplified `std::any` that only holds references, not values.

  Motivation for writing this was to provide an simpler alternative to #18647 by Harris Brakmić (brakmic) which avoids some shortcomings of that PR (https://github.com/bitcoin/bitcoin/pull/18647#issuecomment-617878826)

ACKs for top commit:
  MarcoFalke:
    re-ACK b3f7f375ef, only change is adding back const and more tests 🚾
  ajtowns:
    ACK b3f7f375ef

Tree-SHA512: 56292268a001bdbe34d641db1180c215351503966ff451e55cc96c9137f1d262225d7d7733de9c9da7ce7d7a4b34213a98c2476266b58c89dbbb0f3cb5aa5d70
2020-05-21 06:53:39 -04:00
..
blockchain.cpp Merge #18740: Remove g_rpc_node global 2020-05-21 06:53:39 -04:00
blockchain.h Merge #18740: Remove g_rpc_node global 2020-05-21 06:53:39 -04:00
client.cpp add importdescriptors RPC and tests for native descriptor wallets 2020-04-23 13:59:48 -04:00
client.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
mining.cpp Merge #18740: Remove g_rpc_node global 2020-05-21 06:53:39 -04:00
misc.cpp refactor: Pass NodeContext to RPC and REST methods through util::Ref 2020-05-13 16:20:13 -04:00
net.cpp scripted-diff: Remove g_rpc_node references 2020-05-13 16:20:13 -04:00
protocol.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
rawtransaction.cpp refactor: Pass NodeContext to RPC and REST methods through util::Ref 2020-05-13 16:20:13 -04:00
rawtransaction_util.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
rawtransaction_util.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
register.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
request.cpp rpc: migrate JSONRPCRequest functionality into request.cpp 2019-07-05 11:22:02 +09:00
request.h refactor: Pass NodeContext to RPC and REST methods through util::Ref 2020-05-13 16:20:13 -04:00
server.cpp rpc: Add mutex to guard deadlineTimers 2020-04-29 11:47:57 +01:00
server.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
util.cpp Merge #18607: rpc: Fix named arguments in documentation 2020-04-17 12:16:42 -04:00
util.h Merge #18607: rpc: Fix named arguments in documentation 2020-04-17 12:16:42 -04:00