Bitcoin
blockchain.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2018 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_RPC_BLOCKCHAIN_H
6 #define BITCOIN_RPC_BLOCKCHAIN_H
7 
8 #include <amount.h>
9 #include <sync.h>
10 
11 #include <stdint.h>
12 #include <vector>
13 
14 extern RecursiveMutex cs_main;
15 
16 class CBlock;
17 class CBlockIndex;
18 class CTxMemPool;
19 class UniValue;
20 
21 static constexpr int NUM_GETBLOCKSTATS_PERCENTILES = 5;
22 
29 double GetDifficulty(const CBlockIndex* blockindex);
30 
32 void RPCNotifyBlockChange(bool ibd, const CBlockIndex *);
33 
35 UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIndex* blockindex, bool txDetails = false) LOCKS_EXCLUDED(cs_main);
36 
39 
41 UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose = false);
42 
45 
47 void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_weight);
48 
49 #endif
static constexpr int NUM_GETBLOCKSTATS_PERCENTILES
Definition: blockchain.h:21
UniValue MempoolInfoToJSON(const CTxMemPool &pool)
Definition: blockchain.cpp:1479
void RPCNotifyBlockChange(bool ibd, const CBlockIndex *)
Definition: blockchain.cpp:203
Definition: univalue.h:19
double GetDifficulty(const CBlockIndex *blockindex)
Definition: blockchain.cpp:60
int64_t CAmount
Definition: amount.h:12
UniValue blockheaderToJSON(const CBlockIndex *tip, const CBlockIndex *blockindex) LOCKS_EXCLUDED(cs_main)
Definition: blockchain.cpp:92
UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose=false)
Definition: blockchain.cpp:464
void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector< std::pair< CAmount, int64_t >> &scores, int64_t total_weight)
Definition: blockchain.cpp:1724
#define LOCKS_EXCLUDED(...)
Definition: thread_annotations.h:21
RecursiveMutex cs_main
Definition: validation.cpp:100
Definition: txmempool.h:443
UniValue blockToJSON(const CBlock &block, const CBlockIndex *tip, const CBlockIndex *blockindex, bool txDetails=false) LOCKS_EXCLUDED(cs_main)
Definition: blockchain.cpp:121
Definition: chain.h:139
signed long long int64_t
Definition: stdint.h:18
Definition: block.h:72