mirror of
https://github.com/monero-project/monero.git
synced 2024-12-26 19:49:24 -05:00
protocol: drop peers that decrease claimed height
This commit is contained in:
parent
61f5001c3f
commit
c74d8ffd63
@ -328,6 +328,11 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hshd.current_height < context.m_remote_blockchain_height)
|
||||||
|
{
|
||||||
|
MINFO(context << "Claims " << hshd.current_height << ", claimed " << context.m_remote_blockchain_height << " before");
|
||||||
|
hit_score(context, 1);
|
||||||
|
}
|
||||||
context.m_remote_blockchain_height = hshd.current_height;
|
context.m_remote_blockchain_height = hshd.current_height;
|
||||||
context.m_pruning_seed = hshd.pruning_seed;
|
context.m_pruning_seed = hshd.pruning_seed;
|
||||||
#ifdef CRYPTONOTE_PRUNING_DEBUG_SPOOF_SEED
|
#ifdef CRYPTONOTE_PRUNING_DEBUG_SPOOF_SEED
|
||||||
@ -1112,6 +1117,11 @@ namespace cryptonote
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arg.current_blockchain_height < context.m_remote_blockchain_height)
|
||||||
|
{
|
||||||
|
MINFO(context << "Claims " << arg.current_blockchain_height << ", claimed " << context.m_remote_blockchain_height << " before");
|
||||||
|
hit_score(context, 1);
|
||||||
|
}
|
||||||
context.m_remote_blockchain_height = arg.current_blockchain_height;
|
context.m_remote_blockchain_height = arg.current_blockchain_height;
|
||||||
if (context.m_remote_blockchain_height > m_core.get_target_blockchain_height())
|
if (context.m_remote_blockchain_height > m_core.get_target_blockchain_height())
|
||||||
m_core.set_target_blockchain_height(context.m_remote_blockchain_height);
|
m_core.set_target_blockchain_height(context.m_remote_blockchain_height);
|
||||||
@ -2345,7 +2355,7 @@ skip:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MINFO(context << " we've reached this peer's blockchain height");
|
MINFO(context << " we've reached this peer's blockchain height (theirs " << context.m_remote_blockchain_height << ", our target " << m_core.get_target_blockchain_height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -2472,6 +2482,11 @@ skip:
|
|||||||
drop_connection(context, false, false);
|
drop_connection(context, false, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (arg.total_height < context.m_remote_blockchain_height)
|
||||||
|
{
|
||||||
|
MINFO(context << "Claims " << arg.total_height << ", claimed " << context.m_remote_blockchain_height << " before");
|
||||||
|
hit_score(context, 1);
|
||||||
|
}
|
||||||
context.m_remote_blockchain_height = arg.total_height;
|
context.m_remote_blockchain_height = arg.total_height;
|
||||||
context.m_last_response_height = arg.start_height + arg.m_block_ids.size()-1;
|
context.m_last_response_height = arg.start_height + arg.m_block_ids.size()-1;
|
||||||
if(context.m_last_response_height > context.m_remote_blockchain_height)
|
if(context.m_last_response_height > context.m_remote_blockchain_height)
|
||||||
|
Loading…
Reference in New Issue
Block a user