move struct terminators closer to the structs instead of grouped at the end
@@ -52,8 +52,9 @@ impl Amino for Proposal {
pre[3] |= typ3_to_byte(Typ3Byte::Typ3_Struct);
buf.put_slice(pre.as_slice());
+ {
encode_field_number_typ3(1, Typ3Byte::Typ3_Struct, &mut buf);
-
+ {
// height:
{
encode_field_number_typ3(1, Typ3Byte::Typ3_8Byte, &mut buf);
@@ -100,12 +101,10 @@ impl Amino for Proposal {
}
// parts header:
{
- let field_prefix = 2 << 3 | typ3_to_byte(Typ3Byte::Typ3_Struct);
- buf.put(field_prefix);
+ encode_field_number_typ3(2, Typ3Byte::Typ3_Struct, &mut buf);
{
{
- let field_prefix = 1 << 3 | typ3_to_byte(Typ3Byte::Typ3_Varint);
- buf.put(field_prefix);
+ encode_field_number_typ3(1, Typ3Byte::Typ3_Varint, &mut buf);
encode_varint(self.pol_block_id.parts_header.total as i64, &mut buf);
}
{
@@ -115,6 +114,8 @@ impl Amino for Proposal {
//amino_bytes::encode(&self.pol_block_id.parts_header.hash, &mut buf);
}
}
+ let struct_end_postfix = typ3_to_byte(Typ3Byte::Typ3_StructTerm);
+ buf.put(struct_end_postfix);
}
}
let struct_end_postfix = typ3_to_byte(Typ3Byte::Typ3_StructTerm);
@@ -128,14 +129,12 @@ impl Amino for Proposal {
amino_bytes::encode(&sig.0, &mut buf)
}
}
-
- {
- // remaining struct terminators:
+ }
let struct_end_postfix = typ3_to_byte(Typ3Byte::Typ3_StructTerm);
buf.put(struct_end_postfix);
- buf.put(struct_end_postfix);
- buf.put(struct_end_postfix);
}
+ let struct_end_postfix = typ3_to_byte(Typ3Byte::Typ3_StructTerm);
+ buf.put(struct_end_postfix);
let mut res = vec![];
encode_uvarint(buf.len() as u64, &mut res);
