mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 23:18:55 +00:00
Merge pull request #24 from Neozaru/master
'getinfo' daemon HTTP-RPC returns 'target_height' for progress estimation
This commit is contained in:
commit
3162fcb70f
@ -28,7 +28,8 @@ namespace cryptonote
|
|||||||
m_blockchain_storage(m_mempool),
|
m_blockchain_storage(m_mempool),
|
||||||
m_miner(this),
|
m_miner(this),
|
||||||
m_miner_address(boost::value_initialized<account_public_address>()),
|
m_miner_address(boost::value_initialized<account_public_address>()),
|
||||||
m_starter_message_showed(false)
|
m_starter_message_showed(false),
|
||||||
|
m_target_blockchain_height(0)
|
||||||
{
|
{
|
||||||
set_cryptonote_protocol(pprotocol);
|
set_cryptonote_protocol(pprotocol);
|
||||||
}
|
}
|
||||||
@ -516,4 +517,11 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
void core::set_target_blockchain_height(uint64_t target_blockchain_height) {
|
||||||
|
m_target_blockchain_height = target_blockchain_height;
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
uint64_t core::get_target_blockchain_height() const {
|
||||||
|
return m_target_blockchain_height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,9 @@ namespace cryptonote
|
|||||||
void print_blockchain_outs(const std::string& file);
|
void print_blockchain_outs(const std::string& file);
|
||||||
void on_synchronized();
|
void on_synchronized();
|
||||||
|
|
||||||
|
void set_target_blockchain_height(uint64_t target_blockchain_height);
|
||||||
|
uint64_t get_target_blockchain_height() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block);
|
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block);
|
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
@ -124,6 +127,8 @@ namespace cryptonote
|
|||||||
epee::math_helper::once_a_time_seconds<60*60*12, false> m_store_blockchain_interval;
|
epee::math_helper::once_a_time_seconds<60*60*12, false> m_store_blockchain_interval;
|
||||||
friend class tx_validate_inputs;
|
friend class tx_validate_inputs;
|
||||||
std::atomic<bool> m_starter_message_showed;
|
std::atomic<bool> m_starter_message_showed;
|
||||||
|
|
||||||
|
uint64_t m_target_blockchain_height;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,11 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* As I don't know if accessing hshd from core could be a good practice,
|
||||||
|
I prefer pushing target height to the core at the same time it is pushed to the user.
|
||||||
|
Nz. */
|
||||||
|
m_core.set_target_blockchain_height(static_cast<int64_t>(hshd.current_height));
|
||||||
|
|
||||||
int64_t diff = static_cast<int64_t>(hshd.current_height) - static_cast<int64_t>(m_core.get_current_blockchain_height());
|
int64_t diff = static_cast<int64_t>(hshd.current_height) - static_cast<int64_t>(m_core.get_current_blockchain_height());
|
||||||
LOG_PRINT_CCONTEXT_YELLOW("Sync data returned unknown top block: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height
|
LOG_PRINT_CCONTEXT_YELLOW("Sync data returned unknown top block: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height
|
||||||
<< " [" << std::abs(diff) << " blocks (" << diff / (24 * 60 * 60 / DIFFICULTY_TARGET) << " days) "
|
<< " [" << std::abs(diff) << " blocks (" << diff / (24 * 60 * 60 / DIFFICULTY_TARGET) << " days) "
|
||||||
|
@ -81,6 +81,7 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.height = m_core.get_current_blockchain_height();
|
res.height = m_core.get_current_blockchain_height();
|
||||||
|
res.target_height = m_core.get_target_blockchain_height();
|
||||||
res.difficulty = m_core.get_blockchain_storage().get_difficulty_for_next_block();
|
res.difficulty = m_core.get_blockchain_storage().get_difficulty_for_next_block();
|
||||||
res.tx_count = m_core.get_blockchain_storage().get_total_transactions() - res.height; //without coinbase
|
res.tx_count = m_core.get_blockchain_storage().get_total_transactions() - res.height; //without coinbase
|
||||||
res.tx_pool_size = m_core.get_pool_transactions_count();
|
res.tx_pool_size = m_core.get_pool_transactions_count();
|
||||||
|
@ -214,6 +214,7 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
std::string status;
|
std::string status;
|
||||||
uint64_t height;
|
uint64_t height;
|
||||||
|
uint64_t target_height;
|
||||||
uint64_t difficulty;
|
uint64_t difficulty;
|
||||||
uint64_t tx_count;
|
uint64_t tx_count;
|
||||||
uint64_t tx_pool_size;
|
uint64_t tx_pool_size;
|
||||||
@ -226,6 +227,7 @@ namespace cryptonote
|
|||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(status)
|
KV_SERIALIZE(status)
|
||||||
KV_SERIALIZE(height)
|
KV_SERIALIZE(height)
|
||||||
|
KV_SERIALIZE(target_height)
|
||||||
KV_SERIALIZE(difficulty)
|
KV_SERIALIZE(difficulty)
|
||||||
KV_SERIALIZE(tx_count)
|
KV_SERIALIZE(tx_count)
|
||||||
KV_SERIALIZE(tx_pool_size)
|
KV_SERIALIZE(tx_pool_size)
|
||||||
|
@ -41,6 +41,7 @@ namespace tests
|
|||||||
public:
|
public:
|
||||||
void on_synchronized(){}
|
void on_synchronized(){}
|
||||||
uint64_t get_current_blockchain_height(){return 1;}
|
uint64_t get_current_blockchain_height(){return 1;}
|
||||||
|
void set_target_blockchain_height(uint64_t) {}
|
||||||
bool init(const boost::program_options::variables_map& vm);
|
bool init(const boost::program_options::variables_map& vm);
|
||||||
bool deinit(){return true;}
|
bool deinit(){return true;}
|
||||||
bool get_short_chain_history(std::list<crypto::hash>& ids);
|
bool get_short_chain_history(std::list<crypto::hash>& ids);
|
||||||
|
Loading…
Reference in New Issue
Block a user