Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- Uuid lib was update from v0.7.4 to v1.2.2 in [#1655](https://github.com/KomodoPlatform/atomicDEX-API/pull/1655)
- A bug was fixed in [#1706](https://github.com/KomodoPlatform/atomicDEX-API/pull/1706) where EVM swap transactions were failing if sent before the approval transaction confirmation.
- Tendermint account sequence problem due to running multiple instances were fixed in [#1694](https://github.com/KomodoPlatform/atomicDEX-API/pull/1694)
- Maker/taker pubkeys were added to new columns in `stats_swaps` table in [#1665](https://github.com/KomodoPlatform/atomicDEX-API/pull/1665)
- Maker/taker pubkeys were added to new columns in `stats_swaps` table in [#1665](https://github.com/KomodoPlatform/atomicDEX-API/pull/1665) and [#1717](https://github.com/KomodoPlatform/atomicDEX-API/pull/1717)
- Get rid of unnecessary / old dependencies: `crossterm`, `crossterm_winapi`, `mio 0.7.13`, `miow`, `ntapi`, `signal-hook`, `signal-hook-mio` in [#1710](https://github.com/KomodoPlatform/atomicDEX-API/pull/1710)

## v1.0.0-beta - 2023-03-08
Expand Down
5 changes: 0 additions & 5 deletions mm2src/mm2_main/src/lp_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1455,11 +1455,6 @@ pub struct SwapPubkeys {
pub taker: String,
}

impl SwapPubkeys {
#[inline]
fn new(maker: String, taker: String) -> Self { SwapPubkeys { maker, taker } }
}

#[cfg(all(test, not(target_arch = "wasm32")))]
mod lp_swap_tests {
use super::*;
Expand Down
32 changes: 22 additions & 10 deletions mm2src/mm2_main/src/lp_swap/maker_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1926,19 +1926,31 @@ impl MakerSavedSwap {
}
}

// TODO: Adjust for private coins when/if they are braodcasted
// TODO: Adjust for HD wallet when completed
pub fn swap_pubkeys(&self) -> Result<SwapPubkeys, String> {
match self.events.first() {
let maker = match &self.events.first() {
Some(event) => match &event.event {
// TODO: Adjust for private coins when/if they are braodcasted
Comment thread
shamardy marked this conversation as resolved.
// TODO: Adjust for HD wallet when completed
MakerSwapEvent::Started(data) => Ok(SwapPubkeys::new(
data.my_persistent_pub.to_string(),
data.taker.to_string(),
)),
_ => ERR!("First swap event must be Started"),
MakerSwapEvent::Started(started) => started.my_persistent_pub.to_string(),
_ => return ERR!("First swap event must be Started"),
},
None => ERR!("Can't get maker/taker pubkey, events are empty"),
}
None => return ERR!("Can't get maker's pubkey while events are empty"),
};

let taker = match self.events.get(1) {
Some(event) => match &event.event {
MakerSwapEvent::Negotiated(neg) => {
let Some(key) = neg.taker_coin_htlc_pubkey else {
return ERR!("taker's pubkey is empty");
};
key.to_string()
},
_ => return ERR!("Swap must be negotiated to get taker's pubkey"),
},
None => return ERR!("Can't get taker's pubkey while there's no Negotiated event"),
};

Ok(SwapPubkeys { maker, taker })
}
}

Expand Down
32 changes: 22 additions & 10 deletions mm2src/mm2_main/src/lp_swap/taker_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,19 +303,31 @@ impl TakerSavedSwap {
}
}

// TODO: Adjust for private coins when/if they are braodcasted
// TODO: Adjust for HD wallet when completed
pub fn swap_pubkeys(&self) -> Result<SwapPubkeys, String> {
match self.events.first() {
let taker = match &self.events.first() {
Some(event) => match &event.event {
// TODO: Adjust for private coins when/if they are braodcasted
// TODO: Adjust for HD wallet when completed
TakerSwapEvent::Started(data) => Ok(SwapPubkeys::new(
data.maker.to_string(),
data.my_persistent_pub.to_string(),
)),
_ => ERR!("First swap event must be Started"),
TakerSwapEvent::Started(started) => started.my_persistent_pub.to_string(),
_ => return ERR!("First swap event must be Started"),
},
None => ERR!("Can't get maker/taker pubkey, events are empty"),
}
None => return ERR!("Can't get taker's pubkey while events are empty"),
};

let maker = match self.events.get(1) {
Some(event) => match &event.event {
TakerSwapEvent::Negotiated(neg) => {
let Some(key) = neg.maker_coin_htlc_pubkey else {
return ERR!("maker's pubkey is empty");
};
key.to_string()
},
_ => return ERR!("Swap must be negotiated to get maker's pubkey"),
},
None => return ERR!("Can't get maker's pubkey while there's no Negotiated event"),
};

Ok(SwapPubkeys { maker, taker })
}
}

Expand Down