mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Update monero-serai to limit the size of TX extra
This commit is contained in:
@@ -140,9 +140,9 @@ impl Metadata {
|
||||
/// A received output, defined as its absolute ID, data, and metadara.
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, ZeroizeOnDrop)]
|
||||
pub struct ReceivedOutput {
|
||||
pub absolute: AbsoluteId,
|
||||
pub data: OutputData,
|
||||
pub metadata: Metadata,
|
||||
pub(crate) absolute: AbsoluteId,
|
||||
pub(crate) data: OutputData,
|
||||
pub(crate) metadata: Metadata,
|
||||
}
|
||||
|
||||
impl ReceivedOutput {
|
||||
|
||||
@@ -339,6 +339,12 @@ impl SignableTransaction {
|
||||
// Calculate the extra length
|
||||
let extra = Extra::fee_weight(outputs, has_payment_id, data.as_ref());
|
||||
|
||||
// https://github.com/monero-project/monero/pull/8733
|
||||
const MAX_EXTRA_SIZE: usize = 1060;
|
||||
if extra > MAX_EXTRA_SIZE {
|
||||
Err(TransactionError::TooMuchData)?;
|
||||
}
|
||||
|
||||
// This is a extremely heavy fee weight estimation which can only be trusted for two things
|
||||
// 1) Ensuring we have enough for whatever fee we end up using
|
||||
// 2) Ensuring we aren't over the max size
|
||||
@@ -544,6 +550,7 @@ impl SignableTransaction {
|
||||
|
||||
let mut serialized = Vec::with_capacity(extra_len);
|
||||
extra.write(&mut serialized).unwrap();
|
||||
debug_assert_eq!(extra_len, extra);
|
||||
serialized
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user