File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 24
24
#include < index/blockfilterindex.h>
25
25
#include < index/txindex.h>
26
26
#include < interfaces/chain.h>
27
+ #include < interfaces/node.h>
27
28
#include < key.h>
28
29
#include < miner.h>
29
30
#include < net.h>
@@ -1242,7 +1243,7 @@ bool AppInitLockDataDirectory()
1242
1243
return true ;
1243
1244
}
1244
1245
1245
- bool AppInitMain (const util::Ref& context, NodeContext& node)
1246
+ bool AppInitMain (const util::Ref& context, NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info )
1246
1247
{
1247
1248
const CChainParams& chainparams = Params ();
1248
1249
// ********************************************************* Step 4a: application initialization
@@ -1877,6 +1878,15 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
1877
1878
LOCK (cs_main);
1878
1879
LogPrintf (" block tree size = %u\n " , chainman.BlockIndex ().size ());
1879
1880
chain_active_height = chainman.ActiveChain ().Height ();
1881
+ if (tip_info) {
1882
+ tip_info->block_height = chain_active_height;
1883
+ tip_info->block_time = chainman.ActiveChain ().Tip () ? chainman.ActiveChain ().Tip ()->GetBlockTime () : Params ().GenesisBlock ().GetBlockTime ();
1884
+ tip_info->verification_progress = GuessVerificationProgress (Params ().TxData (), chainman.ActiveChain ().Tip ());
1885
+ }
1886
+ if (tip_info && ::pindexBestHeader) {
1887
+ tip_info->header_height = ::pindexBestHeader->nHeight ;
1888
+ tip_info->header_time = ::pindexBestHeader->GetBlockTime ();
1889
+ }
1880
1890
}
1881
1891
LogPrintf (" nBestHeight = %d\n " , chain_active_height);
1882
1892
Original file line number Diff line number Diff line change 11
11
#include < util/system.h>
12
12
13
13
struct NodeContext ;
14
+ namespace interfaces {
15
+ struct BlockAndHeaderTipInfo ;
16
+ }
14
17
namespace boost {
15
18
class thread_group ;
16
19
} // namespace boost
@@ -54,7 +57,7 @@ bool AppInitLockDataDirectory();
54
57
* @note This should only be done after daemonization. Call Shutdown() if this function fails.
55
58
* @pre Parameters should be parsed and config file should be read, AppInitLockDataDirectory should have been called.
56
59
*/
57
- bool AppInitMain (const util::Ref& context, NodeContext& node);
60
+ bool AppInitMain (const util::Ref& context, NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info = nullptr );
58
61
59
62
/* *
60
63
* Register all arguments with the ArgsManager
You can’t perform that action at this time.
0 commit comments