Optimized new block processing. Added quick-ban for those, who send wrong blocks.

This commit is contained in:
Revertron
2021-04-17 01:51:14 +02:00
parent de61d17845
commit 47c398118a
4 changed files with 72 additions and 57 deletions
+4
View File
@@ -611,6 +611,10 @@ impl Chain {
/// Check if this block can be added to our blockchain
pub fn check_new_block(&self, block: &Block) -> BlockQuality {
if block.version > CHAIN_VERSION {
warn!("Ignoring block from unsupported version:\n{:?}", &block);
return Bad;
}
let timestamp = Utc::now().timestamp();
if block.timestamp > timestamp + 60 {
warn!("Ignoring block from the future:\n{:?}", &block);