Stop deriving PartialEq for MetaAddr
This makes sure Ord and ParitalEq are always consistent.
This commit is contained in:
parent
078385ae00
commit
bf6fe175dd
|
@ -106,7 +106,7 @@ impl PartialOrd for PeerAddrState {
|
||||||
/// An address with metadata on its advertised services and last-seen time.
|
/// An address with metadata on its advertised services and last-seen time.
|
||||||
///
|
///
|
||||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#Network_address)
|
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#Network_address)
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct MetaAddr {
|
pub struct MetaAddr {
|
||||||
/// The peer's address.
|
/// The peer's address.
|
||||||
pub addr: SocketAddr,
|
pub addr: SocketAddr,
|
||||||
|
@ -319,6 +319,14 @@ impl PartialOrd for MetaAddr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for MetaAddr {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.cmp(other) == Ordering::Equal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Eq for MetaAddr {}
|
||||||
|
|
||||||
impl ZcashSerialize for MetaAddr {
|
impl ZcashSerialize for MetaAddr {
|
||||||
fn zcash_serialize<W: Write>(&self, mut writer: W) -> Result<(), std::io::Error> {
|
fn zcash_serialize<W: Write>(&self, mut writer: W) -> Result<(), std::io::Error> {
|
||||||
writer.write_u32::<LittleEndian>(
|
writer.write_u32::<LittleEndian>(
|
||||||
|
|
Loading…
Reference in New Issue