Skip to content

Commit

Permalink
Check that milestone message PoW is 0 (#1374)
Browse files Browse the repository at this point in the history
* Check that milestone message PoW is 0

* Update bee-protocol/src/workers/message/processor.rs

Co-authored-by: Jochen Görtler <grtlr@users.noreply.github.com>

* Clippy

Co-authored-by: Jochen Görtler <grtlr@users.noreply.github.com>
  • Loading branch information
thibault-martinez and grtlr authored Apr 28, 2022
1 parent dc841e0 commit f940e29
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bee-protocol/src/workers/message/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ where
continue;
}

if pow_score < config.minimum_pow_score {
if let Some(Payload::Milestone(_)) = message.payload() {
if message.nonce() != 0 {
notify_invalid_message(
format!("Non-zero milestone nonce: {}.", message.nonce()),
&metrics,
notifier,
);
continue;
}
} else if pow_score < config.minimum_pow_score {
notify_invalid_message(
format!("Insufficient pow score: {} < {}.", pow_score, config.minimum_pow_score),
&metrics,
Expand Down

0 comments on commit f940e29

Please sign in to comment.