diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-09-17 19:05:26 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2019-10-28 10:30:51 -0400 |
commit | 362ded410b8cb1104b7ef31ff8488fec4824a7d5 (patch) | |
tree | 0ffc9c199a3b7adcb9957b19824bff8c0fe33bb0 /src/rpc/blockchain.h | |
parent | 8922d7f6b751a3e6b3b9f6fb7961c442877fb65a (diff) | |
download | bitcoin-362ded410b8cb1104b7ef31ff8488fec4824a7d5.tar.xz |
Avoid using g_rpc_node global in wallet code
Wallet code should use interfaces::Chain and not directly access to node state.
Add a g_rpc_chain replacement global for wallet code to use, and move
g_rpc_node definition to a libbitcoin_server source file so there are link
errors if wallet code tries to access it.
Diffstat (limited to 'src/rpc/blockchain.h')
-rw-r--r-- | src/rpc/blockchain.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h index ff461fbcbc..8a1264f824 100644 --- a/src/rpc/blockchain.h +++ b/src/rpc/blockchain.h @@ -17,6 +17,7 @@ class CBlock; class CBlockIndex; class CTxMemPool; class UniValue; +struct NodeContext; static constexpr int NUM_GETBLOCKSTATS_PERCENTILES = 5; @@ -46,4 +47,9 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex /** Used by getblockstats to get feerates at different percentiles by weight */ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_weight); +//! Pointer to node state that needs to be declared as a global to be accessible +//! RPC methods. Due to limitations of the RPC framework, there's currently no +//! direct way to pass in state to RPC methods without globals. +extern NodeContext* g_rpc_node; + #endif |