Skip to content

Commit 992cc63

Browse files
committed
Add Eq Hash traits for RouteHop
1 parent ea96e54 commit 992cc63

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use util::logger::Logger;
2424
use std::cmp;
2525
use std::collections::{HashMap,BinaryHeap};
2626
use std::ops::Deref;
27+
use std::hash::{Hash, Hasher};
2728

2829
/// A hop in a route
2930
#[derive(Clone, PartialEq)]
@@ -45,6 +46,15 @@ pub struct RouteHop {
4546
pub cltv_expiry_delta: u32,
4647
}
4748

49+
impl Eq for RouteHop {}
50+
impl Hash for RouteHop {
51+
fn hash<H: Hasher>(&self, state: &mut H) {
52+
self.short_channel_id.hash(state);
53+
self.fee_msat.hash(state);
54+
}
55+
}
56+
57+
4858
impl Writeable for Vec<RouteHop> {
4959
fn write<W: ::util::ser::Writer>(&self, writer: &mut W) -> Result<(), ::std::io::Error> {
5060
(self.len() as u8).write(writer)?;

0 commit comments

Comments
 (0)