mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-16 16:42:03 +00:00
Don't attempt parsing truncated InInstructions
This commit is contained in:
parent
69c3fad7ce
commit
2472ec7ba8
1 changed files with 3 additions and 5 deletions
|
@ -685,16 +685,14 @@ async fn run<N: Network, D: Db, Co: Coordinator>(mut raw_db: D, network: N, mut
|
||||||
|
|
||||||
let mut data = output.data();
|
let mut data = output.data();
|
||||||
let max_data_len = usize::try_from(MAX_DATA_LEN).unwrap();
|
let max_data_len = usize::try_from(MAX_DATA_LEN).unwrap();
|
||||||
// TODO: Should we drop this, instead of truncating?
|
// TODO: Refund if we hit one of the following continues
|
||||||
// A truncating message likely doesn't have value yet has increased data load and is
|
|
||||||
// corrupt vs a NOP. The former seems more likely to cause problems
|
|
||||||
if data.len() > max_data_len {
|
if data.len() > max_data_len {
|
||||||
error!(
|
error!(
|
||||||
"data in output {} exceeded MAX_DATA_LEN ({MAX_DATA_LEN}): {}. truncating",
|
"data in output {} exceeded MAX_DATA_LEN ({MAX_DATA_LEN}): {}. skipping",
|
||||||
hex::encode(output.id()),
|
hex::encode(output.id()),
|
||||||
data.len(),
|
data.len(),
|
||||||
);
|
);
|
||||||
data = &data[.. max_data_len];
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Ok(shorthand) = Shorthand::decode(&mut data) else { continue };
|
let Ok(shorthand) = Shorthand::decode(&mut data) else { continue };
|
||||||
|
|
Loading…
Reference in a new issue