mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-28 23:08:52 +01:00
rpc: Add getindexinfo RPC
This commit is contained in:
@@ -319,3 +319,12 @@ void BaseIndex::Stop()
|
||||
m_thread_sync.join();
|
||||
}
|
||||
}
|
||||
|
||||
IndexSummary BaseIndex::GetSummary() const
|
||||
{
|
||||
IndexSummary summary{};
|
||||
summary.name = GetName();
|
||||
summary.synced = m_synced;
|
||||
summary.best_block_height = m_best_block_index.load()->nHeight;
|
||||
return summary;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
|
||||
class CBlockIndex;
|
||||
|
||||
struct IndexSummary {
|
||||
std::string name;
|
||||
bool synced{false};
|
||||
int best_block_height{0};
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for indices of blockchain data. This implements
|
||||
* CValidationInterface and ensures blocks are indexed sequentially according
|
||||
@@ -106,6 +112,9 @@ public:
|
||||
|
||||
/// Stops the instance from staying in sync with blockchain updates.
|
||||
void Stop();
|
||||
|
||||
/// Get a summary of the index and its state.
|
||||
IndexSummary GetSummary() const;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_INDEX_BASE_H
|
||||
|
||||
Reference in New Issue
Block a user