mirror of
https://github.com/mimblewimble/grin.git
synced 2025-05-01 14:51:14 +03:00
Cleanup ping-pong serialization
This commit is contained in:
parent
2b90ba08c2
commit
a45d17257a
1 changed files with 4 additions and 18 deletions
|
@ -626,15 +626,8 @@ impl Writeable for Ping {
|
|||
|
||||
impl Readable for Ping {
|
||||
fn read(reader: &mut Reader) -> Result<Ping, ser::Error> {
|
||||
// TODO - once everyone is sending total_difficulty we can clean this up
|
||||
let total_difficulty = match Difficulty::read(reader) {
|
||||
Ok(diff) => diff,
|
||||
Err(_) => Difficulty::zero(),
|
||||
};
|
||||
let height = match reader.read_u64() {
|
||||
Ok(h) => h,
|
||||
Err(_) => 0,
|
||||
};
|
||||
let total_difficulty = Difficulty::read(reader)?;
|
||||
let height = reader.read_u64()?;
|
||||
Ok(Ping {
|
||||
total_difficulty,
|
||||
height,
|
||||
|
@ -660,15 +653,8 @@ impl Writeable for Pong {
|
|||
|
||||
impl Readable for Pong {
|
||||
fn read(reader: &mut Reader) -> Result<Pong, ser::Error> {
|
||||
// TODO - once everyone is sending total_difficulty we can clean this up
|
||||
let total_difficulty = match Difficulty::read(reader) {
|
||||
Ok(diff) => diff,
|
||||
Err(_) => Difficulty::zero(),
|
||||
};
|
||||
let height = match reader.read_u64() {
|
||||
Ok(h) => h,
|
||||
Err(_) => 0,
|
||||
};
|
||||
let total_difficulty = Difficulty::read(reader)?;
|
||||
let height = reader.read_u64()?;
|
||||
Ok(Pong {
|
||||
total_difficulty,
|
||||
height,
|
||||
|
|
Loading…
Add table
Reference in a new issue