From 26d13030347c468bcce7f932570fc4d8a477bed8 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 22 May 2019 12:35:17 +0200 Subject: [PATCH] Don't panic if extra_data is longer than VANITY_LENGTH (#10682) * Don't panic if extra_data is longer than VANITY_LENGTH Seems like `extra_data().len()` can be longer than 32 (was 39 here) so this fixes that panic. * Update ethcore/src/engines/clique/mod.rs --- ethcore/src/engines/clique/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/engines/clique/mod.rs b/ethcore/src/engines/clique/mod.rs index 1ae30905e..38a27e58d 100644 --- a/ethcore/src/engines/clique/mod.rs +++ b/ethcore/src/engines/clique/mod.rs @@ -713,7 +713,7 @@ impl Engine for Clique { } } - let zero_padding_len = VANITY_LENGTH - header.extra_data().len(); + let zero_padding_len = VANITY_LENGTH.saturating_sub(header.extra_data().len()); if zero_padding_len > 0 { let mut resized_extra_data = header.extra_data().clone(); resized_extra_data.resize(VANITY_LENGTH, 0);