mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: use correct boolean conversion for direction (#870)
This commit is contained in:
@ -134,8 +134,8 @@ mod test {
|
||||
};
|
||||
use hex_literal::hex;
|
||||
use reth_primitives::{
|
||||
BlockHashOrNumber, Header, Signature, Transaction, TransactionKind, TransactionSigned,
|
||||
TxLegacy, U256,
|
||||
BlockHashOrNumber, Header, HeadersDirection, Signature, Transaction, TransactionKind,
|
||||
TransactionSigned, TxLegacy, U256,
|
||||
};
|
||||
use reth_rlp::{Decodable, Encodable};
|
||||
use std::str::FromStr;
|
||||
@ -207,7 +207,7 @@ mod test {
|
||||
),
|
||||
limit: 5,
|
||||
skip: 5,
|
||||
direction: Default::default(),
|
||||
direction: HeadersDirection::Rising,
|
||||
},
|
||||
}
|
||||
.encode(&mut data);
|
||||
@ -228,7 +228,7 @@ mod test {
|
||||
),
|
||||
limit: 5,
|
||||
skip: 5,
|
||||
direction: Default::default(),
|
||||
direction: HeadersDirection::Rising,
|
||||
},
|
||||
};
|
||||
let result = RequestPair::decode(&mut &data[..]);
|
||||
@ -246,7 +246,7 @@ mod test {
|
||||
start_block: BlockHashOrNumber::Number(9999),
|
||||
limit: 5,
|
||||
skip: 5,
|
||||
direction: Default::default(),
|
||||
direction: HeadersDirection::Rising,
|
||||
},
|
||||
}
|
||||
.encode(&mut data);
|
||||
@ -263,7 +263,7 @@ mod test {
|
||||
start_block: BlockHashOrNumber::Number(9999),
|
||||
limit: 5,
|
||||
skip: 5,
|
||||
direction: Default::default(),
|
||||
direction: HeadersDirection::Rising,
|
||||
},
|
||||
};
|
||||
let result = RequestPair::decode(&mut &data[..]);
|
||||
|
||||
@ -366,14 +366,6 @@ impl<T> Encodable for RequestPair<T>
|
||||
where
|
||||
T: Encodable,
|
||||
{
|
||||
fn length(&self) -> usize {
|
||||
let mut length = 0;
|
||||
length += self.request_id.length();
|
||||
length += self.message.length();
|
||||
length += length_of_length(length);
|
||||
length
|
||||
}
|
||||
|
||||
fn encode(&self, out: &mut dyn reth_rlp::BufMut) {
|
||||
let header =
|
||||
Header { list: true, payload_length: self.request_id.length() + self.message.length() };
|
||||
@ -382,6 +374,14 @@ where
|
||||
self.request_id.encode(out);
|
||||
self.message.encode(out);
|
||||
}
|
||||
|
||||
fn length(&self) -> usize {
|
||||
let mut length = 0;
|
||||
length += self.request_id.length();
|
||||
length += self.message.length();
|
||||
length += length_of_length(length);
|
||||
length
|
||||
}
|
||||
}
|
||||
|
||||
/// Allows messages with request ids to be deserialized into RLP bytes.
|
||||
|
||||
Reference in New Issue
Block a user