diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-27 12:14:43 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-27 12:21:35 +0200 |
commit | e6dcfeec05d6527ab148550836937ff435e6449c (patch) | |
tree | 08be69b20b3acb139378636597e938c5864696f1 /src/rpc/blockchain.h | |
parent | 5114f8113627791b871c88998bd5a3d36961c241 (diff) |
refactor: Move GetDifficulty out of `rpc/server.h`
It has no business in `rpcserver.h`. Define it in the interface header
of the implementation unit `rpcblockchain` where it is defined.
Also modernize the signature to:
double GetDifficulty(const CBlockIndex* blockindex = nullptr);
(remove `extern`, replace `NULL` with `nullptr`)
Diffstat (limited to 'src/rpc/blockchain.h')
-rw-r--r-- | src/rpc/blockchain.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h new file mode 100644 index 0000000000..69cba8f019 --- /dev/null +++ b/src/rpc/blockchain.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_RPC_BLOCKCHAIN_H +#define BITCOIN_RPC_BLOCKCHAIN_H + +class CBlockIndex; + +/** + * Get the difficulty of the net wrt to the given block index, or the chain tip if + * not provided. + * + * @return A floating point number that is a multiple of the main net minimum + * difficulty (4295032833 hashes). + */ +double GetDifficulty(const CBlockIndex* blockindex = nullptr); + +#endif + |