MarcoFalke
25ad2c623a
Merge #18740 : Remove g_rpc_node global
...
b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520 refactor: Remove g_rpc_node global (Russell Yanofsky)
ccb5059ee89f6e8dc31ba5b82830b384890bb65e scripted-diff: Remove g_rpc_node references (Russell Yanofsky)
6fca33b2edc09ed62dab2323c780b31585de1750 refactor: Pass NodeContext to RPC and REST methods through util::Ref (Russell Yanofsky)
691c817b340d10e806dc3b1834d2a8fcc5e681fd 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 b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520
Tree-SHA512: 56292268a001bdbe34d641db1180c215351503966ff451e55cc96c9137f1d262225d7d7733de9c9da7ce7d7a4b34213a98c2476266b58c89dbbb0f3cb5aa5d70
2020-05-21 06:53:39 -04:00
..
2020-05-20 07:30:29 -04:00
2020-05-07 15:45:09 +08:00
2020-04-16 13:33:09 -04:00
2020-01-28 17:00:01 +01:00
2020-04-07 13:57:34 -07:00
2020-05-20 07:30:29 -04:00
2020-05-21 06:53:39 -04:00
2020-01-28 16:59:07 +01:00
2020-04-30 18:02:04 +08:00
2020-05-20 07:30:29 -04:00
2020-03-30 16:10:30 -07:00
2020-05-20 07:30:29 -04:00
2020-05-20 11:09:29 +02:00
2020-05-21 06:53:39 -04:00
2020-05-20 07:30:29 -04:00
2019-03-31 11:41:05 -07:00
2020-05-04 16:31:07 +02:00
2020-05-21 06:53:39 -04:00
2020-02-09 07:44:29 -08:00
2020-05-13 16:20:13 -04:00
2020-05-21 06:53:39 -04:00
2020-04-16 13:33:09 -04:00
2019-10-14 13:24:54 +03:00
2019-12-30 10:42:20 +13:00
2020-01-02 11:05:36 -08:00
2020-05-06 14:59:28 +02:00
2020-03-04 14:24:19 +01:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2020-03-10 09:52:53 -04:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-10-16 08:56:57 -07:00
2019-09-05 13:25:11 +12:00
2020-04-19 10:05:29 +08:00
2020-04-16 13:33:09 -04:00
2019-01-30 16:26:52 -05:00
2020-04-16 13:33:09 -04:00
2020-05-13 16:20:13 -04:00
2019-12-30 10:42:20 +13:00
2020-05-20 07:30:29 -04:00
2020-04-20 14:57:48 +00:00
2019-12-30 10:42:20 +13:00
2020-04-28 19:27:22 +02:00
2020-05-20 07:30:29 -04:00
2019-12-30 10:42:20 +13:00
2020-04-16 13:33:09 -04:00
2020-04-16 13:33:09 -04:00
2020-04-16 13:33:09 -04:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2020-04-03 16:29:26 +02:00
2020-04-16 13:33:09 -04:00
2020-05-04 19:53:58 +03:00
2020-05-03 18:42:14 +00:00
2020-05-06 13:15:28 +02:00
2019-01-23 16:28:27 +08:00
2019-12-30 10:42:20 +13:00
2020-04-16 13:33:09 -04:00
2019-12-30 10:42:20 +13:00
2020-04-16 13:33:09 -04:00
2019-12-30 10:42:20 +13:00
2020-04-08 14:45:27 +00:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2020-05-01 07:39:00 -04:00
2019-02-22 17:38:45 -08:00
2020-05-20 07:30:29 -04:00
2020-01-04 20:18:28 +02:00
2019-12-30 10:42:20 +13:00
2019-03-31 11:41:05 -07:00
2020-05-21 06:53:39 -04:00
2020-05-13 16:20:13 -04:00
2020-05-19 10:41:44 -04:00
2020-04-16 13:33:09 -04:00
2020-04-16 13:33:09 -04:00
2020-05-21 06:53:39 -04:00
2020-05-13 16:20:13 -04:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2020-04-16 11:08:46 -04:00
2020-04-16 11:08:46 -04:00
2020-05-21 06:53:39 -04:00
2020-04-21 15:06:59 +02:00
2020-01-28 17:01:48 +01:00
2020-05-12 18:03:39 +03:00
2020-04-01 12:49:15 +02:00
2020-05-12 09:47:06 -04:00
2019-11-21 21:13:08 +01:00
2020-04-05 01:01:13 +02:00
2020-04-05 10:46:24 +08:00
2020-05-13 16:20:13 -04:00
2020-04-16 13:33:09 -04:00
2020-03-30 16:09:51 -07:00
2020-03-30 16:09:51 -07:00
2020-04-16 13:33:09 -04:00
2020-04-16 13:33:09 -04:00
2020-01-08 12:35:59 +00:00
2020-04-16 13:33:09 -04:00
2020-05-19 15:18:06 +08:00
2020-05-08 16:36:18 -04:00
2019-10-29 11:30:12 +02:00
2020-05-10 15:58:42 +02:00
2020-05-12 17:30:33 +08:00
2020-05-06 14:59:28 +02:00
2020-05-20 07:30:29 -04:00
2020-01-22 20:20:45 +01:00
2020-01-08 12:35:59 +00:00
2020-05-05 04:45:59 +03:00
2020-05-05 04:45:59 +03:00
2019-12-30 10:42:20 +13:00
2020-04-16 13:33:09 -04:00
2020-01-23 16:35:06 -05:00
2020-04-30 18:02:03 +08:00
2020-05-08 16:36:19 -04:00
2020-05-20 07:30:29 -04:00
2020-04-16 13:33:09 -04:00
2020-04-23 13:16:23 +12:00
2019-12-30 10:42:20 +13:00
2020-04-23 13:59:48 -04:00
2020-05-15 08:58:49 -04:00
2020-04-30 09:19:14 -04:00
2020-04-16 13:33:09 -04:00
2019-11-12 14:50:44 -08:00
2020-05-21 06:53:39 -04:00
2020-04-16 13:33:09 -04:00
2020-03-10 09:47:32 -04:00
2020-05-20 07:30:29 -04:00
2020-04-30 11:16:56 +02:00
2019-12-30 10:42:20 +13:00
2020-03-27 08:59:06 -04:00
2020-03-31 08:36:02 -05:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2020-05-05 04:45:59 +03:00
2019-12-06 10:02:08 +01:00
2020-01-08 12:35:59 +00:00
2019-12-30 10:42:20 +13:00
2020-05-20 07:30:29 -04:00
2020-01-15 02:18:00 +07:00
2020-04-29 16:32:37 +08:00
2020-04-23 14:42:25 -07:00
2020-05-19 02:49:32 +03:00
2020-05-19 02:49:32 +03:00
2020-01-23 16:35:08 -05:00
2020-01-23 16:35:08 -05:00
2020-04-16 13:33:09 -04:00
2020-05-19 02:49:32 +03:00
2020-05-19 02:49:32 +03:00
2020-05-13 19:57:55 -04:00
2020-05-13 19:57:55 -04:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00
2019-12-30 10:42:20 +13:00