diff --git a/src/new_index/schema.rs b/src/new_index/schema.rs index 0927d1e..fab286e 100644 --- a/src/new_index/schema.rs +++ b/src/new_index/schema.rs @@ -1377,31 +1377,43 @@ impl ColorIdRow { } fn prefix() -> Bytes { - bincode::serialize(&(b'B')) + bincode::options() + .with_big_endian() + .serialize(&(b'B')) .unwrap() } fn filter_end(block_height: u32, color_id: &Option) -> Bytes { let filter = if let Some(color_id) = color_id { - bincode::serialize(&(b'B', block_height, b'c', &serialize_color_id(&color_id))) - .unwrap() + bincode::options() + .with_big_endian() + .serialize(&(b'B', block_height, b'c', &serialize_color_id(&color_id))) + .unwrap() } else { - bincode::serialize(&(b'B', block_height + 1, b'c')) - .unwrap() + bincode::options() + .with_big_endian() + .serialize(&(b'B', block_height + 1, b'c')) + .unwrap() }; filter } pub fn into_row(self) -> DBRow { + let key = bincode::options() + .with_big_endian() + .serialize(&(b'B', self.key.block_height, b'c', &serialize_color_id(&self.key.color_id))) + .unwrap(); DBRow { - key: bincode::serialize(&(b'B', self.key.block_height, b'c', &serialize_color_id(&self.key.color_id))).unwrap(), + key: key, value: vec![], } } pub fn from_row(row: DBRow) -> Self { let (_prefix, block_height, _prefix2, token_type, payload): (u8, u32, u8, u8, [u8; 32]) = - bincode::deserialize(&row.key).expect("failed to deserialize ColorIdRow"); + bincode::options() + .with_big_endian() + .deserialize(&row.key).expect("failed to deserialize ColorIdRow"); ColorIdRow { key: ColorIdKey { block_height: block_height,