mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 19:33:28 +01:00
blockchain: include number of discarded blocks in --reorg-notify
This commit is contained in:
parent
4d598e3d4d
commit
356d813799
@ -1056,6 +1056,7 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we're to keep the disconnected blocks, add them as alternates
|
// if we're to keep the disconnected blocks, add them as alternates
|
||||||
|
const size_t discarded_blocks = disconnected_chain.size();
|
||||||
if(!discard_disconnected_chain)
|
if(!discard_disconnected_chain)
|
||||||
{
|
{
|
||||||
//pushing old chain as alternative chain
|
//pushing old chain as alternative chain
|
||||||
@ -1083,7 +1084,7 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::
|
|||||||
std::shared_ptr<tools::Notify> reorg_notify = m_reorg_notify;
|
std::shared_ptr<tools::Notify> reorg_notify = m_reorg_notify;
|
||||||
if (reorg_notify)
|
if (reorg_notify)
|
||||||
reorg_notify->notify("%s", std::to_string(split_height).c_str(), "%h", std::to_string(m_db->height()).c_str(),
|
reorg_notify->notify("%s", std::to_string(split_height).c_str(), "%h", std::to_string(m_db->height()).c_str(),
|
||||||
"%n", std::to_string(m_db->height() - split_height).c_str(), NULL);
|
"%n", std::to_string(m_db->height() - split_height).c_str(), "%d", std::to_string(discarded_blocks).c_str(), NULL);
|
||||||
|
|
||||||
MGINFO_GREEN("REORGANIZE SUCCESS! on height: " << split_height << ", new blockchain size: " << m_db->height());
|
MGINFO_GREEN("REORGANIZE SUCCESS! on height: " << split_height << ", new blockchain size: " << m_db->height());
|
||||||
return true;
|
return true;
|
||||||
|
@ -188,8 +188,9 @@ namespace cryptonote
|
|||||||
static const command_line::arg_descriptor<std::string> arg_reorg_notify = {
|
static const command_line::arg_descriptor<std::string> arg_reorg_notify = {
|
||||||
"reorg-notify"
|
"reorg-notify"
|
||||||
, "Run a program for each reorg, '%s' will be replaced by the split height, "
|
, "Run a program for each reorg, '%s' will be replaced by the split height, "
|
||||||
"'%h' will be replaced by the new blockchain height, and '%n' will be "
|
"'%h' will be replaced by the new blockchain height, '%n' will be "
|
||||||
"replaced by the number of new blocks in the new chain"
|
"replaced by the number of new blocks in the new chain, and '%d' will be "
|
||||||
|
"replaced by the number of blocks discarded from the old chain"
|
||||||
, ""
|
, ""
|
||||||
};
|
};
|
||||||
static const command_line::arg_descriptor<std::string> arg_block_rate_notify = {
|
static const command_line::arg_descriptor<std::string> arg_block_rate_notify = {
|
||||||
|
Loading…
Reference in New Issue
Block a user