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
This commit is contained in:
David 2019-05-22 12:35:17 +02:00 committed by Andronik Ordian
parent 89987745f6
commit 26d1303034

View File

@ -713,7 +713,7 @@ impl Engine<EthereumMachine> 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);