mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-11 17:55:46 +00:00
Define MAX_SIZE constant for CompactSize serialization
This commit is contained in:
parent
1f11c404dc
commit
cc183efda4
@ -1,6 +1,8 @@
|
||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||
use std::io::{self, Read, Write};
|
||||
|
||||
const MAX_SIZE: usize = 0x02000000;
|
||||
|
||||
struct CompactSize;
|
||||
|
||||
impl CompactSize {
|
||||
@ -33,7 +35,7 @@ impl CompactSize {
|
||||
n => Ok(n as usize),
|
||||
}
|
||||
}? {
|
||||
s if s > 0x02000000 => Err(io::Error::new(
|
||||
s if s > MAX_SIZE => Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"CompactSize too large",
|
||||
)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user