mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
Add basic arithmetic to Amount
type
This commit is contained in:
parent
09dfe3931d
commit
6abcb18145
1 changed files with 20 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue