Add basic arithmetic to Amount type

This commit is contained in:
elsirion
2022-05-13 22:23:34 +00:00
committed by Christian Decker
parent 09dfe3931d
commit 6abcb18145

View File

@@ -78,6 +78,26 @@ impl Amount {
}
}
impl std::ops::Add for Amount {
type Output = Amount;
fn add(self, rhs: Self) -> Self::Output {
Amount {
msat: self.msat + rhs.msat
}
}
}
impl std::ops::Sub for Amount {
type Output = Amount;
fn sub(self, rhs: Self) -> Self::Output {
Amount {
msat: self.msat - rhs.msat
}
}
}
#[derive(Clone, Copy, Debug)]
pub struct ShortChannelId(u64);