[DO NOT MERGE] Enable additional logs #712

Closed
hirunda wants to merge 1 commit from local_enable_logs_for_irona into develop
2 changed files with 12 additions and 0 deletions

View file

@ -467,6 +467,12 @@ public:
auto last_irr = _chain_db->get_dynamic_global_properties().last_irreversible_block_num;
ilog("Got block: #${n} time: ${t} latency: ${l} ms from: ${w} irreversible: ${i} (-${d})",
("t", blk_msg.block.timestamp)("n", blk_msg.block.block_num())("l", (latency.count() / 1000))("w", witness_account.name)("i", last_irr)("d", blk_msg.block.block_num() - last_irr));
}else
{
const auto &witness = blk_msg.block.witness(*_chain_db);
const auto &witness_account = witness.witness_account(*_chain_db);
ilog("Got block in sync: #${n} time: ${t} from: ${w}",
("t", blk_msg.block.timestamp)("n", blk_msg.block.block_num())("w", witness_account.name));
}
FC_ASSERT((latency.count() / 1000) > -5000, "Rejecting block with timestamp in the future");

View file

@ -1873,6 +1873,7 @@ namespace graphene { namespace net { namespace detail {
user_data["last_known_block_number"] = _delegate->get_block_number(head_block_id);
user_data["last_known_block_time"] = _delegate->get_block_time(head_block_id);
user_data["last_known_hardfork_time"] = _delegate->get_last_known_hardfork_time().sec_since_epoch();
std::cout<<"!!!!! I am sending hardfork time: "<< _delegate->get_last_known_hardfork_time().sec_since_epoch()<<std::endl;
if (!_hard_fork_block_numbers.empty())
user_data["last_known_fork_block_number"] = _hard_fork_block_numbers.back();
@ -1901,6 +1902,7 @@ namespace graphene { namespace net { namespace detail {
originating_peer->last_known_fork_block_number = user_data["last_known_fork_block_number"].as<uint32_t>(1);
if (user_data.contains("last_known_hardfork_time")){
originating_peer->last_known_hardfork_time = fc::time_point_sec(user_data["last_known_hardfork_time"].as<uint32_t>(1));
std::cout<<"I am receiving hardfork time: "<<originating_peer->last_known_hardfork_time.sec_since_epoch()<<std::endl;
}else{
// this state is invalid when node which wants to connect doesn't provide
// last hardfork time. We are setting to 0 which will disconnect the node
@ -1908,6 +1910,7 @@ namespace graphene { namespace net { namespace detail {
originating_peer->last_known_hardfork_time = fc::time_point_sec(0);
if(DISABLE_WITNESS_HF_CHECK) {
originating_peer->last_known_hardfork_time = _delegate->get_last_known_hardfork_time();
std::cout<<"!!!!! I am not receiving hardfork time, so I am setting it to: "<<originating_peer->last_known_hardfork_time.sec_since_epoch()<<std::endl;
}
}
}
@ -2034,6 +2037,7 @@ namespace graphene { namespace net { namespace detail {
if ((_delegate->get_block_time(_delegate->get_head_block_id()).sec_since_epoch() >= _delegate->get_last_known_hardfork_time().sec_since_epoch())
|| originating_peer->last_known_hardfork_time.sec_since_epoch() == 0)
{
std::cout<<"Disconnet on hello message"<<std::endl;
std::ostringstream rejection_message;
rejection_message << "Your client is outdated -- you can only understand blocks up to #" << originating_peer->last_known_hardfork_time.to_iso_string() << ", but I'm already on block #" << _delegate->get_block_time(_delegate->get_head_block_id()).to_iso_string();
disconnect_peer(rejection_message);
@ -3167,6 +3171,7 @@ namespace graphene { namespace net { namespace detail {
{
if( block_message_to_send.block.timestamp.sec_since_epoch() >= _delegate->get_last_known_hardfork_time().sec_since_epoch() )
{
std::cout<<"Disconnect on sync"<<std::endl;
std::ostringstream disconnect_reason_stream;
disconnect_reason_stream << "You need to upgrade your client due to hard fork at block " << block_message_to_send.block.timestamp.to_iso_string();
disconnect_peer(disconnect_reason_stream, peer, disconnecting_this_peer);
@ -3459,6 +3464,7 @@ namespace graphene { namespace net { namespace detail {
if(_delegate->get_last_known_hardfork_time().sec_since_epoch() < originating_peer->last_known_hardfork_time.sec_since_epoch()
&& block_message_to_process.block.timestamp.sec_since_epoch() >= originating_peer->last_known_hardfork_time.sec_since_epoch() )
{
std::cout<<"Disconnect during normal normal block processing"<<std::endl;
rejecting_block_due_hf = true;
}